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

Unified Diff: base/base_paths_posix.cc

Issue 10808048: Revert r144460 "Remove the linux-only CR_SOURCE_ROOT environment variable override of base::DIR_SOU… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better Created 8 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 | testing/test_env.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base_paths_posix.cc
diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc
index d8d5ae61b7285ab113eb46718610a25e08773bf7..a1c45a03df1c470bd15a9af31044ac4241780bc4 100644
--- a/base/base_paths_posix.cc
+++ b/base/base_paths_posix.cc
@@ -74,6 +74,20 @@ bool PathProviderPosix(int key, FilePath* result) {
#endif
}
case base::DIR_SOURCE_ROOT: {
+ // Allow passing this in the environment, for more flexibility in build
+ // tree configurations (sub-project builds, gyp --output_dir, etc.)
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::string cr_source_root;
+ if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) {
+ path = FilePath(cr_source_root);
+ if (file_util::PathExists(path)) {
+ *result = path;
+ return true;
+ } else {
+ DLOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not "
+ << "point to a directory.";
+ }
+ }
// On POSIX, unit tests execute two levels deep from the source root.
// For example: out/{Debug|Release}/net_unittest
if (PathService::Get(base::DIR_EXE, &path)) {
« no previous file with comments | « no previous file | testing/test_env.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698