| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_linux.h" | 5 #include "base/base_paths_linux.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) { | 25 if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) { |
| 26 NOTREACHED() << "Unable to resolve /proc/self/exe."; | 26 NOTREACHED() << "Unable to resolve /proc/self/exe."; |
| 27 return false; | 27 return false; |
| 28 } | 28 } |
| 29 bin_dir[bin_dir_size] = 0; | 29 bin_dir[bin_dir_size] = 0; |
| 30 *result = FilePath(bin_dir); | 30 *result = FilePath(bin_dir); |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 case base::DIR_SOURCE_ROOT: | 33 case base::DIR_SOURCE_ROOT: |
| 34 // On linux, unit tests execute two levels deep from the source root. | 34 // On linux, unit tests execute two levels deep from the source root. |
| 35 // For example: chrome/{Debug|Hammer}/net_unittest | 35 // For example: sconsbuild/{Debug|Release}/net_unittest |
| 36 if (!PathService::Get(base::DIR_EXE, &path)) | 36 if (!PathService::Get(base::DIR_EXE, &path)) |
| 37 return false; | 37 return false; |
| 38 path = path.Append(FilePath::kParentDirectory) | 38 path = path.Append(FilePath::kParentDirectory) |
| 39 .Append(FilePath::kParentDirectory); | 39 .Append(FilePath::kParentDirectory); |
| 40 *result = path; | 40 *result = path; |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace base | 46 } // namespace base |
| OLD | NEW |