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

Side by Side Diff: base/base_paths_mac.mm

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « base/base.isolate ('k') | base/base_paths_win.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines base::PathProviderMac which replaces base::PathProviderPosix for Mac 5 // Defines base::PathProviderMac which replaces base::PathProviderPosix for Mac
6 // in base/path_service.cc. 6 // in base/path_service.cc.
7 7
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 #include <mach-o/dyld.h> 10 #include <mach-o/dyld.h>
(...skipping 11 matching lines...) Expand all
22 namespace { 22 namespace {
23 23
24 void GetNSExecutablePath(base::FilePath* path) { 24 void GetNSExecutablePath(base::FilePath* path) {
25 DCHECK(path); 25 DCHECK(path);
26 // Executable path can have relative references ("..") depending on 26 // Executable path can have relative references ("..") depending on
27 // how the app was launched. 27 // how the app was launched.
28 uint32_t executable_length = 0; 28 uint32_t executable_length = 0;
29 _NSGetExecutablePath(NULL, &executable_length); 29 _NSGetExecutablePath(NULL, &executable_length);
30 DCHECK_GT(executable_length, 1u); 30 DCHECK_GT(executable_length, 1u);
31 std::string executable_path; 31 std::string executable_path;
32 int rv = _NSGetExecutablePath(WriteInto(&executable_path, executable_length), 32 int rv = _NSGetExecutablePath(
33 &executable_length); 33 base::WriteInto(&executable_path, executable_length), &executable_length);
34 DCHECK_EQ(rv, 0); 34 DCHECK_EQ(rv, 0);
35 35
36 // _NSGetExecutablePath may return paths containing ./ or ../ which makes 36 // _NSGetExecutablePath may return paths containing ./ or ../ which makes
37 // FilePath::DirName() work incorrectly, convert it to absolute path so that 37 // FilePath::DirName() work incorrectly, convert it to absolute path so that
38 // paths such as DIR_SOURCE_ROOT can work, since we expect absolute paths to 38 // paths such as DIR_SOURCE_ROOT can work, since we expect absolute paths to
39 // be returned here. 39 // be returned here.
40 *path = base::MakeAbsoluteFilePath(base::FilePath(executable_path)); 40 *path = base::MakeAbsoluteFilePath(base::FilePath(executable_path));
41 } 41 }
42 42
43 // Returns true if the module for |address| is found. |path| will contain 43 // Returns true if the module for |address| is found. |path| will contain
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return base::mac::GetUserDirectory(NSDesktopDirectory, result); 105 return base::mac::GetUserDirectory(NSDesktopDirectory, result);
106 #endif 106 #endif
107 case base::DIR_CACHE: 107 case base::DIR_CACHE:
108 return base::mac::GetUserDirectory(NSCachesDirectory, result); 108 return base::mac::GetUserDirectory(NSCachesDirectory, result);
109 default: 109 default:
110 return false; 110 return false;
111 } 111 }
112 } 112 }
113 113
114 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « base/base.isolate ('k') | base/base_paths_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698