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

Unified Diff: base/base_paths_mac.mm

Issue 18309008: Fix GetNSExecutablePath for running tests with relative path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_mac.mm
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index 1e8bac80b7f2aa40238270b7f8f2e5c81c7239cf..db900b874ca07da9f3f9d5e84903494a5a069a66 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -32,7 +32,11 @@ void GetNSExecutablePath(base::FilePath* path) {
int rv = _NSGetExecutablePath(WriteInto(&executable_path, executable_length),
&executable_length);
DCHECK_EQ(rv, 0);
- *path = base::FilePath(executable_path);
+
+ // _NSGetExecutablePath may return paths containing ./ or ../ which makes
+ // FilePath::DirName() work incorrectly, convert it to absolute path so that
+ // paths such as DIR_SOURCE_ROOT can work.
+ *path = base::MakeAbsoluteFilePath(base::FilePath(executable_path));
Nico 2013/07/10 18:02:31 Hm, are you sure these paths never get persisted s
brettw 2013/08/06 04:52:06 We do want an absolute path here. We should be sur
}
// Returns true if the module for |address| is found. |path| will contain
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698