OLD | NEW |
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 <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.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 34 matching lines...) Loading... |
45 switch (key) { | 45 switch (key) { |
46 case base::FILE_EXE: | 46 case base::FILE_EXE: |
47 case base::FILE_MODULE: { | 47 case base::FILE_MODULE: { |
48 return GetNSExecutablePath(result); | 48 return GetNSExecutablePath(result); |
49 } | 49 } |
50 case base::DIR_USER_CACHE: | 50 case base::DIR_USER_CACHE: |
51 return mac_util::GetUserDirectory(NSCachesDirectory, result); | 51 return mac_util::GetUserDirectory(NSCachesDirectory, result); |
52 case base::DIR_APP_DATA: | 52 case base::DIR_APP_DATA: |
53 return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result); | 53 return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result); |
54 case base::DIR_SOURCE_ROOT: { | 54 case base::DIR_SOURCE_ROOT: { |
55 if (GetNSExecutablePath(result)) { | 55 // Go through PathService go catch overrides. |
| 56 if (PathService::Get(base::FILE_EXE, result)) { |
56 // Start with the executable's directory. | 57 // Start with the executable's directory. |
57 *result = result->DirName(); | 58 *result = result->DirName(); |
58 if (mac_util::AmIBundled()) { | 59 if (mac_util::AmIBundled()) { |
59 // The bundled app executables (Chromium, TestShell, etc) live five | 60 // The bundled app executables (Chromium, TestShell, etc) live five |
60 // levels down, eg: | 61 // levels down, eg: |
61 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium | 62 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium |
62 *result = result->DirName().DirName().DirName().DirName().DirName(); | 63 *result = result->DirName().DirName().DirName().DirName().DirName(); |
63 } else { | 64 } else { |
64 // Unit tests execute two levels deep from the source root, eg: | 65 // Unit tests execute two levels deep from the source root, eg: |
65 // src/xcodebuild/{Debug|Release}/base_unittests | 66 // src/xcodebuild/{Debug|Release}/base_unittests |
66 *result = result->DirName().DirName(); | 67 *result = result->DirName().DirName(); |
67 } | 68 } |
68 } | 69 } |
69 return true; | 70 return true; |
70 } | 71 } |
71 default: | 72 default: |
72 return false; | 73 return false; |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 } // namespace base | 77 } // namespace base |
OLD | NEW |