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

Side by Side Diff: base/base_paths_posix.cc

Issue 2865002: Support for DIR_SOURCE_ROOT in a case of WebKit-only checkout.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This is really Posix minus Mac. Mac code is in base_paths_mac.mm. 5 // This is really Posix minus Mac. Mac code is in base_paths_mac.mm.
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 8
9 #include <unistd.h> 9 #include <unistd.h>
10 #if defined(OS_FREEBSD) 10 #if defined(OS_FREEBSD)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 // On POSIX, unit tests execute two levels deep from the source root. 76 // On POSIX, unit tests execute two levels deep from the source root.
77 // For example: sconsbuild/{Debug|Release}/net_unittest 77 // For example: sconsbuild/{Debug|Release}/net_unittest
78 if (PathService::Get(base::DIR_EXE, &path)) { 78 if (PathService::Get(base::DIR_EXE, &path)) {
79 path = path.DirName().DirName(); 79 path = path.DirName().DirName();
80 if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { 80 if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) {
81 *result = path; 81 *result = path;
82 return true; 82 return true;
83 } 83 }
84 } 84 }
85 // In a case of WebKit-only checkout, executable files are put into
86 // WebKit/out/{Debug|Release}, and we should return WebKit/WebKit/chromium
87 // for DIR_SOURCE_ROOT.
88 if (PathService::Get(base::DIR_EXE, &path)) {
89 path = path.DirName().DirName().Append("WebKit/chromium");
90 if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) {
91 *result = path;
92 return true;
93 }
94 }
85 // If that failed (maybe the build output is symlinked to a different 95 // If that failed (maybe the build output is symlinked to a different
86 // drive) try assuming the current directory is the source root. 96 // drive) try assuming the current directory is the source root.
87 if (file_util::GetCurrentDirectory(&path) && 97 if (file_util::GetCurrentDirectory(&path) &&
88 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { 98 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) {
89 *result = path; 99 *result = path;
90 return true; 100 return true;
91 } 101 }
92 LOG(ERROR) << "Couldn't find your source root. " 102 LOG(ERROR) << "Couldn't find your source root. "
93 << "Try running from your chromium/src directory."; 103 << "Try running from your chromium/src directory.";
94 return false; 104 return false;
95 } 105 }
96 case base::DIR_USER_CACHE: 106 case base::DIR_USER_CACHE:
97 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); 107 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create());
98 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", 108 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME",
99 ".cache")); 109 ".cache"));
100 *result = cache_dir; 110 *result = cache_dir;
101 return true; 111 return true;
102 } 112 }
103 return false; 113 return false;
104 } 114 }
105 115
106 } // namespace base 116 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/base_paths_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698