OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Defines base::PathProviderPosix, default path provider on POSIX OSes that |
| 6 // don't have their own base_paths_OS.cc implementation (i.e. all but Mac and |
| 7 // Android). |
6 | 8 |
7 #include <ostream> | 9 #include <ostream> |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "build/build_config.h" | 12 #include "base/base_paths.h" |
11 #include "base/environment.h" | 13 #include "base/environment.h" |
12 #include "base/file_path.h" | 14 #include "base/file_path.h" |
13 #include "base/file_util.h" | 15 #include "base/file_util.h" |
14 #include "base/logging.h" | 16 #include "base/logging.h" |
15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
16 #include "base/path_service.h" | 18 #include "base/path_service.h" |
17 #include "base/process_util.h" | 19 #include "base/process_util.h" |
18 #include "base/nix/xdg_util.h" | 20 #include "base/nix/xdg_util.h" |
| 21 #include "build/build_config.h" |
19 | 22 |
20 #if defined(OS_FREEBSD) | 23 #if defined(OS_FREEBSD) |
21 #include <sys/param.h> | 24 #include <sys/param.h> |
22 #include <sys/sysctl.h> | 25 #include <sys/sysctl.h> |
23 #elif defined(OS_SOLARIS) | 26 #elif defined(OS_SOLARIS) |
24 #include <stdlib.h> | 27 #include <stdlib.h> |
25 #endif | 28 #endif |
26 | 29 |
27 namespace base { | 30 namespace base { |
28 | 31 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // For example: out/{Debug|Release}/net_unittest | 92 // For example: out/{Debug|Release}/net_unittest |
90 if (PathService::Get(base::DIR_EXE, &path)) { | 93 if (PathService::Get(base::DIR_EXE, &path)) { |
91 *result = path.DirName().DirName(); | 94 *result = path.DirName().DirName(); |
92 return true; | 95 return true; |
93 } | 96 } |
94 | 97 |
95 DLOG(ERROR) << "Couldn't find your source root. " | 98 DLOG(ERROR) << "Couldn't find your source root. " |
96 << "Try running from your chromium/src directory."; | 99 << "Try running from your chromium/src directory."; |
97 return false; | 100 return false; |
98 } | 101 } |
| 102 case base::DIR_USER_DESKTOP: |
| 103 *result = base::nix::GetXDGUserDirectory("DESKTOP", "Desktop"); |
| 104 return true; |
99 case base::DIR_CACHE: { | 105 case base::DIR_CACHE: { |
100 scoped_ptr<base::Environment> env(base::Environment::Create()); | 106 scoped_ptr<base::Environment> env(base::Environment::Create()); |
101 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 107 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
102 ".cache")); | 108 ".cache")); |
103 *result = cache_dir; | 109 *result = cache_dir; |
104 return true; | 110 return true; |
105 } | 111 } |
106 case base::DIR_HOME: { | 112 case base::DIR_HOME: |
107 *result = file_util::GetHomeDir(); | 113 *result = file_util::GetHomeDir(); |
108 return true; | 114 return true; |
109 } | |
110 } | 115 } |
111 return false; | 116 return false; |
112 } | 117 } |
113 | 118 |
114 } // namespace base | 119 } // namespace base |
OLD | NEW |