Chromium Code Reviews| 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 which is the default path provider for paths |
|
brettw
2012/09/14 22:10:06
Isn't this just used on Liunx then? I think base_p
gab
2012/09/16 03:13:51
I was saying the same thing, but grt@ didn't agree
| |
| 6 // on POSIX OSes that don't have their own base_paths_OS.cc implementation (i.e. | |
| 7 // all POSIX OSes, but Mac and 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 "build/build_config.h" |
| 13 #include "base/base_paths.h" | |
| 11 #include "base/environment.h" | 14 #include "base/environment.h" |
| 12 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 14 #include "base/logging.h" | 17 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 17 #include "base/nix/xdg_util.h" | 20 #include "base/nix/xdg_util.h" |
| 18 | 21 |
| 19 #if defined(OS_FREEBSD) | 22 #if defined(OS_FREEBSD) |
| 20 #include <sys/param.h> | 23 #include <sys/param.h> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 // For example: out/{Debug|Release}/net_unittest | 95 // For example: out/{Debug|Release}/net_unittest |
| 93 if (PathService::Get(base::DIR_EXE, &path)) { | 96 if (PathService::Get(base::DIR_EXE, &path)) { |
| 94 *result = path.DirName().DirName(); | 97 *result = path.DirName().DirName(); |
| 95 return true; | 98 return true; |
| 96 } | 99 } |
| 97 | 100 |
| 98 DLOG(ERROR) << "Couldn't find your source root. " | 101 DLOG(ERROR) << "Couldn't find your source root. " |
| 99 << "Try running from your chromium/src directory."; | 102 << "Try running from your chromium/src directory."; |
| 100 return false; | 103 return false; |
| 101 } | 104 } |
| 105 case base::DIR_USER_DESKTOP: { | |
| 106 *result = base::nix::GetXDGUserDirectory("DESKTOP", "Desktop"); | |
| 107 return true; | |
| 108 } | |
| 102 case base::DIR_CACHE: { | 109 case base::DIR_CACHE: { |
| 103 scoped_ptr<base::Environment> env(base::Environment::Create()); | 110 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 104 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 111 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
| 105 ".cache")); | 112 ".cache")); |
| 106 *result = cache_dir; | 113 *result = cache_dir; |
| 107 return true; | 114 return true; |
| 108 } | 115 } |
| 109 case base::DIR_HOME: { | 116 case base::DIR_HOME: { |
| 110 *result = file_util::GetHomeDir(); | 117 *result = file_util::GetHomeDir(); |
| 111 return true; | 118 return true; |
| 112 } | 119 } |
| 113 } | 120 } |
| 114 return false; | 121 return false; |
| 115 } | 122 } |
| 116 | 123 |
| 117 } // namespace base | 124 } // namespace base |
| OLD | NEW |