OLD | NEW |
1 // Copyright (c) 2006-2008 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 | 10 |
| 11 #include "base/env_var.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/file_util.h" | 13 #include "base/file_util.h" |
13 #include "base/linux_util.h" | 14 #include "base/linux_util.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
17 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 | 21 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // drive) try assuming the current directory is the source root. | 56 // drive) try assuming the current directory is the source root. |
56 if (file_util::GetCurrentDirectory(&path) && | 57 if (file_util::GetCurrentDirectory(&path) && |
57 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { | 58 file_util::PathExists(path.Append("base/base_paths_posix.cc"))) { |
58 *result = path; | 59 *result = path; |
59 return true; | 60 return true; |
60 } | 61 } |
61 LOG(ERROR) << "Couldn't find your source root. " | 62 LOG(ERROR) << "Couldn't find your source root. " |
62 << "Try running from your chromium/src directory."; | 63 << "Try running from your chromium/src directory."; |
63 return false; | 64 return false; |
64 case base::DIR_USER_CACHE: | 65 case base::DIR_USER_CACHE: |
65 scoped_ptr<base::EnvironmentVariableGetter> env( | 66 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); |
66 base::EnvironmentVariableGetter::Create()); | |
67 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 67 FilePath cache_dir(base::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
68 ".cache")); | 68 ".cache")); |
69 *result = cache_dir; | 69 *result = cache_dir; |
70 return true; | 70 return true; |
71 } | 71 } |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 } // namespace base | 75 } // namespace base |
OLD | NEW |