diff options
author | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 06:53:52 +0000 |
---|---|---|
committer | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 06:53:52 +0000 |
commit | 14a25e5040c14ac6760509693e971781cce21705 (patch) | |
tree | f66d204c0e8b0177b9bc4299cfe3423388d1d763 /base | |
parent | 8cff4c7cfbc5d1805a8e4a87fcd60bcab097dfd0 (diff) | |
download | chromium_src-14a25e5040c14ac6760509693e971781cce21705.zip chromium_src-14a25e5040c14ac6760509693e971781cce21705.tar.gz chromium_src-14a25e5040c14ac6760509693e971781cce21705.tar.bz2 |
Support for DIR_SOURCE_ROOT in a case of WebKit-only checkout.
BUG=none
TEST=none. It's hard to write tests for DIR_SOURCE_ROOT without DIR_SOURCE_ROOT.
Review URL: http://codereview.chromium.org/2865002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base_paths_posix.cc | 10 | ||||
-rw-r--r-- | base/base_paths_win.cc | 16 |
2 files changed, 23 insertions, 3 deletions
diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc index e55d10c..710d799 100644 --- a/base/base_paths_posix.cc +++ b/base/base_paths_posix.cc @@ -82,6 +82,16 @@ bool PathProviderPosix(int key, FilePath* result) { return true; } } + // In a case of WebKit-only checkout, executable files are put into + // WebKit/out/{Debug|Release}, and we should return WebKit/WebKit/chromium + // for DIR_SOURCE_ROOT. + if (PathService::Get(base::DIR_EXE, &path)) { + path = path.DirName().DirName().Append("WebKit/chromium"); + if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { + *result = path; + return true; + } + } // If that failed (maybe the build output is symlinked to a different // drive) try assuming the current directory is the source root. if (file_util::GetCurrentDirectory(&path) && diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc index 47d7d4a..2b4912e 100644 --- a/base/base_paths_win.cc +++ b/base/base_paths_win.cc @@ -105,12 +105,22 @@ bool PathProviderWin(int key, FilePath* result) { return false; cur = FilePath(system_buffer); break; - case base::DIR_SOURCE_ROOT: + case base::DIR_SOURCE_ROOT: { + FilePath executableDir; // On Windows, unit tests execute two levels deep from the source root. // For example: chrome/{Debug|Release}/ui_tests.exe - PathService::Get(base::DIR_EXE, &cur); - cur = cur.DirName().DirName(); + PathService::Get(base::DIR_EXE, &executableDir); + cur = executableDir.DirName().DirName(); + FilePath checkedPath = + cur.Append(FILE_PATH_LITERAL("base/base_paths_win.cc")); + if (!file_util::PathExists(checkedPath)) { + // Check for WebKit-only checkout. Executable files are put into + // WebKit/WebKit/chromium/{Debug|Relese}, and we should return + // WebKit/WebKit/chromium. + cur = executableDir.DirName(); + } break; + } default: return false; } |