Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6755)

Unified Diff: chrome/common/chrome_paths_mac.mm

Issue 267102: Better code to determine the framework and helper app paths (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/chrome_paths_mac.mm
===================================================================
--- chrome/common/chrome_paths_mac.mm (revision 28987)
+++ chrome/common/chrome_paths_mac.mm (working copy)
@@ -67,34 +67,18 @@
}
FilePath GetVersionedDirectory() {
- static FilePath path;
+ // Start out with the path to the running .app.
+ NSBundle* app_bundle = [NSBundle mainBundle];
TVL 2009/10/14 21:09:15 since the concern in here was threading, http://de
Mark Mentovai 2009/10/14 21:26:46 TVL wrote:
+ FilePath path = FilePath([[app_bundle bundlePath] fileSystemRepresentation]);
- if (path.empty()) {
- // Start out with the path to the running .app.
- NSBundle* app_bundle = [NSBundle mainBundle];
- path = FilePath([[app_bundle bundlePath] fileSystemRepresentation]);
-
- if (mac_util::IsBackgroundOnlyProcess()) {
- // path identifies the helper .app in the browser .app's versioned
- // directory. Go up one level to get to the browser .app's versioned
- // directory.
- path = path.DirName();
- } else {
- // path identifies the browser .app. Go into its versioned directory.
- // TODO(mark): Here, |version| comes from the outer .app bundle's
- // Info.plist. In the event of an incomplete update, it may be possible
- // for this value to be incorrect. Consider the case where the updater
- // is able to update one, but not both, of the executable and the
- // Info.plist. The executable may load one version of the framework,
- // and the Info.plist may refer to another version. Ideally, the
- // version would be available in a compile-time constant, or there would
- // be a better way to detect the loaded framework version at runtime.
- NSString* version =
- [app_bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
- path = path.Append("Contents").
- Append("Versions").
- Append([version fileSystemRepresentation]);
- }
+ if (mac_util::IsBackgroundOnlyProcess()) {
+ // path identifies the helper .app in the browser .app's versioned
+ // directory. Go up one level to get to the browser .app's versioned
+ // directory.
+ path = path.DirName();
+ } else {
+ // path identifies the browser .app. Go into its versioned directory.
+ path = path.Append("Contents").Append("Versions").Append(kChromeVersion);
}
return path;

Powered by Google App Engine
This is Rietveld 408576698