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

Side by Side Diff: base/base_paths_mac.mm

Issue 7019041: Fix up PathProvider on the Mac for FILE_MODULE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/mac/foundation_util.h » ('j') | base/mac/foundation_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base_paths_mac.h" 5 #include "base/base_paths_mac.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <mach-o/dyld.h> 8 #include <mach-o/dyld.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 26 matching lines...) Expand all
37 return true; 37 return true;
38 } 38 }
39 39
40 } // namespace 40 } // namespace
41 41
42 namespace base { 42 namespace base {
43 43
44 bool PathProviderMac(int key, FilePath* result) { 44 bool PathProviderMac(int key, FilePath* result) {
45 switch (key) { 45 switch (key) {
46 case base::FILE_EXE: 46 case base::FILE_EXE:
47 case base::FILE_MODULE: {
48 return GetNSExecutablePath(result); 47 return GetNSExecutablePath(result);
49 } 48 case base::FILE_MODULE:
49 return base::mac::GetModulePathForSymbol(result,
50 reinterpret_cast<const void*>(&base::PathProviderMac));
50 case base::DIR_CACHE: 51 case base::DIR_CACHE:
51 return base::mac::GetUserDirectory(NSCachesDirectory, result); 52 return base::mac::GetUserDirectory(NSCachesDirectory, result);
52 case base::DIR_APP_DATA: 53 case base::DIR_APP_DATA:
53 return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result); 54 return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
54 case base::DIR_SOURCE_ROOT: { 55 case base::DIR_SOURCE_ROOT: {
55 // Go through PathService to catch overrides. 56 // Go through PathService to catch overrides.
56 if (!PathService::Get(base::FILE_EXE, result)) 57 if (!PathService::Get(base::FILE_EXE, result))
57 return false; 58 return false;
58 59
59 // Start with the executable's directory. 60 // Start with the executable's directory.
60 *result = result->DirName(); 61 *result = result->DirName();
61 if (base::mac::AmIBundled()) { 62 if (base::mac::AmIBundled()) {
62 // The bundled app executables (Chromium, TestShell, etc) live five 63 // The bundled app executables (Chromium, TestShell, etc) live five
63 // levels down, eg: 64 // levels down, eg:
64 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium 65 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
65 *result = result->DirName().DirName().DirName().DirName().DirName(); 66 *result = result->DirName().DirName().DirName().DirName().DirName();
66 } else { 67 } else {
67 // Unit tests execute two levels deep from the source root, eg: 68 // Unit tests execute two levels deep from the source root, eg:
68 // src/xcodebuild/{Debug|Release}/base_unittests 69 // src/xcodebuild/{Debug|Release}/base_unittests
69 *result = result->DirName().DirName(); 70 *result = result->DirName().DirName();
70 } 71 }
71 return true; 72 return true;
72 } 73 }
73 default: 74 default:
74 return false; 75 return false;
75 } 76 }
76 } 77 }
77 78
78 } // namespace base 79 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/mac/foundation_util.h » ('j') | base/mac/foundation_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698