OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bin_dir[strlen(bin_dir)] = 0; | 56 bin_dir[strlen(bin_dir)] = 0; |
57 *result = FilePath(bin_dir); | 57 *result = FilePath(bin_dir); |
58 return true; | 58 return true; |
59 #endif | 59 #endif |
60 } | 60 } |
61 case base::DIR_SOURCE_ROOT: { | 61 case base::DIR_SOURCE_ROOT: { |
62 // Allow passing this in the environment, for more flexibility in build | 62 // Allow passing this in the environment, for more flexibility in build |
63 // tree configurations (sub-project builds, gyp --output_dir, etc.) | 63 // tree configurations (sub-project builds, gyp --output_dir, etc.) |
64 scoped_ptr<base::Environment> env(base::Environment::Create()); | 64 scoped_ptr<base::Environment> env(base::Environment::Create()); |
65 std::string cr_source_root; | 65 std::string cr_source_root; |
66 if (env->GetEnv("CR_SOURCE_ROOT", &cr_source_root)) { | 66 if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) { |
67 path = FilePath(cr_source_root); | 67 path = FilePath(cr_source_root); |
68 if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { | 68 if (file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { |
69 *result = path; | 69 *result = path; |
70 return true; | 70 return true; |
71 } else { | 71 } else { |
72 LOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not " | 72 LOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not " |
73 << "point to the correct source root directory."; | 73 << "point to the correct source root directory."; |
74 } | 74 } |
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. |
(...skipping 30 matching lines...) Expand all Loading... |
107 scoped_ptr<base::Environment> env(base::Environment::Create()); | 107 scoped_ptr<base::Environment> env(base::Environment::Create()); |
108 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 108 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
109 ".cache")); | 109 ".cache")); |
110 *result = cache_dir; | 110 *result = cache_dir; |
111 return true; | 111 return true; |
112 } | 112 } |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 } // namespace base | 116 } // namespace base |
OLD | NEW |