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

Side by Side Diff: base/base_paths_mac.mm

Issue 6046009: Move base/mac_util.h to base/mac and use the base::mac namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | « base/base.gypi ('k') | base/file_version_info_mac.mm » ('j') | no next file with comments »
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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 17
18 namespace { 18 namespace {
19 19
20 bool GetNSExecutablePath(FilePath* path) WARN_UNUSED_RESULT; 20 bool GetNSExecutablePath(FilePath* path) WARN_UNUSED_RESULT;
21 21
22 bool GetNSExecutablePath(FilePath* path) { 22 bool GetNSExecutablePath(FilePath* path) {
23 DCHECK(path); 23 DCHECK(path);
24 // Executable path can have relative references ("..") depending on 24 // Executable path can have relative references ("..") depending on
(...skipping 16 matching lines...) Expand all
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: { 47 case base::FILE_MODULE: {
48 return GetNSExecutablePath(result); 48 return GetNSExecutablePath(result);
49 } 49 }
50 case base::DIR_CACHE: 50 case base::DIR_CACHE:
51 return mac_util::GetUserDirectory(NSCachesDirectory, result); 51 return base::mac::GetUserDirectory(NSCachesDirectory, result);
52 case base::DIR_APP_DATA: 52 case base::DIR_APP_DATA:
53 return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result); 53 return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
54 case base::DIR_SOURCE_ROOT: { 54 case base::DIR_SOURCE_ROOT: {
55 // Go through PathService to catch overrides. 55 // Go through PathService to catch overrides.
56 if (PathService::Get(base::FILE_EXE, result)) { 56 if (PathService::Get(base::FILE_EXE, result)) {
57 // Start with the executable's directory. 57 // Start with the executable's directory.
58 *result = result->DirName(); 58 *result = result->DirName();
59 if (mac_util::AmIBundled()) { 59 if (base::mac::AmIBundled()) {
60 // The bundled app executables (Chromium, TestShell, etc) live five 60 // The bundled app executables (Chromium, TestShell, etc) live five
61 // levels down, eg: 61 // levels down, eg:
62 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium 62 // src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
63 *result = result->DirName().DirName().DirName().DirName().DirName(); 63 *result = result->DirName().DirName().DirName().DirName().DirName();
64 } else { 64 } else {
65 // Unit tests execute two levels deep from the source root, eg: 65 // Unit tests execute two levels deep from the source root, eg:
66 // src/xcodebuild/{Debug|Release}/base_unittests 66 // src/xcodebuild/{Debug|Release}/base_unittests
67 *result = result->DirName().DirName(); 67 *result = result->DirName().DirName();
68 } 68 }
69 } 69 }
70 return true; 70 return true;
71 } 71 }
72 default: 72 default:
73 return false; 73 return false;
74 } 74 }
75 } 75 }
76 76
77 } // namespace base 77 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/file_version_info_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698