| 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 <ostream> | 7 #include <ostream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 *result = FilePath(bin_dir); | 59 *result = FilePath(bin_dir); |
| 60 return true; | 60 return true; |
| 61 #elif defined(OS_SOLARIS) | 61 #elif defined(OS_SOLARIS) |
| 62 char bin_dir[PATH_MAX + 1]; | 62 char bin_dir[PATH_MAX + 1]; |
| 63 if (realpath(getexecname(), bin_dir) == NULL) { | 63 if (realpath(getexecname(), bin_dir) == NULL) { |
| 64 NOTREACHED() << "Unable to resolve " << getexecname() << "."; | 64 NOTREACHED() << "Unable to resolve " << getexecname() << "."; |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 *result = FilePath(bin_dir); | 67 *result = FilePath(bin_dir); |
| 68 return true; | 68 return true; |
| 69 #elif defined(OS_OPENBSD) |
| 70 // There is currently no way to get the executable path on OpenBSD |
| 71 *result = FilePath("/usr/local/chrome/chrome"); |
| 72 return true; |
| 69 #endif | 73 #endif |
| 70 } | 74 } |
| 71 case base::DIR_SOURCE_ROOT: { | 75 case base::DIR_SOURCE_ROOT: { |
| 72 // Allow passing this in the environment, for more flexibility in build | 76 // Allow passing this in the environment, for more flexibility in build |
| 73 // tree configurations (sub-project builds, gyp --output_dir, etc.) | 77 // tree configurations (sub-project builds, gyp --output_dir, etc.) |
| 74 scoped_ptr<base::Environment> env(base::Environment::Create()); | 78 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 75 std::string cr_source_root; | 79 std::string cr_source_root; |
| 76 if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) { | 80 if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) { |
| 77 path = FilePath(cr_source_root); | 81 path = FilePath(cr_source_root); |
| 78 if (file_util::PathExists(path.Append(kThisSourceFile))) { | 82 if (file_util::PathExists(path.Append(kThisSourceFile))) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 scoped_ptr<base::Environment> env(base::Environment::Create()); | 121 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 118 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", | 122 FilePath cache_dir(base::nix::GetXDGDirectory(env.get(), "XDG_CACHE_HOME", |
| 119 ".cache")); | 123 ".cache")); |
| 120 *result = cache_dir; | 124 *result = cache_dir; |
| 121 return true; | 125 return true; |
| 122 } | 126 } |
| 123 return false; | 127 return false; |
| 124 } | 128 } |
| 125 | 129 |
| 126 } // namespace base | 130 } // namespace base |
| OLD | NEW |