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