OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/base_paths.h" | 5 #include "base/base_paths.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <ostream> |
8 #if defined(OS_FREEBSD) | 8 #include <string> |
9 #include <sys/param.h> | |
10 #include <sys/sysctl.h> | |
11 #endif | |
12 | 9 |
| 10 #include "build/build_config.h" |
13 #include "base/environment.h" | 11 #include "base/environment.h" |
14 #include "base/file_path.h" | 12 #include "base/file_path.h" |
15 #include "base/file_util.h" | 13 #include "base/file_util.h" |
16 #include "base/logging.h" | 14 #include "base/logging.h" |
17 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
18 #include "base/path_service.h" | 16 #include "base/path_service.h" |
19 #include "base/sys_string_conversions.h" | |
20 #include "base/nix/xdg_util.h" | 17 #include "base/nix/xdg_util.h" |
21 | 18 |
| 19 #if defined(OS_FREEBSD) |
| 20 #include <sys/param.h> |
| 21 #include <sys/sysctl.h> |
| 22 #endif |
| 23 |
22 namespace base { | 24 namespace base { |
23 | 25 |
24 #if defined(OS_LINUX) | 26 #if defined(OS_LINUX) |
25 const char kSelfExe[] = "/proc/self/exe"; | 27 const char kSelfExe[] = "/proc/self/exe"; |
26 #elif defined(OS_SOLARIS) | 28 #elif defined(OS_SOLARIS) |
27 const char kSelfExe[] = getexecname(); | 29 const char kSelfExe[] = getexecname(); |
28 #endif | 30 #endif |
29 | 31 |
30 // The name of this file relative to the source root. This is used for checking | 32 // The name of this file relative to the source root. This is used for checking |
31 // that the source checkout is in the correct place. | 33 // that the source checkout is in the correct place. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 scoped_ptr<base::Environment> env(base::Environment::Create()); | 109 scoped_ptr<base::Environment> env(base::Environment::Create()); |
108 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 110 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
109 ".cache")); | 111 ".cache")); |
110 *result = cache_dir; | 112 *result = cache_dir; |
111 return true; | 113 return true; |
112 } | 114 } |
113 return false; | 115 return false; |
114 } | 116 } |
115 | 117 |
116 } // namespace base | 118 } // namespace base |
OLD | NEW |