OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium 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 "testing/utils/path_service.h" | 5 #include "testing/utils/path_service.h" |
6 | 6 |
7 #ifdef _WIN32 | 7 #ifdef _WIN32 |
8 #include <Windows.h> | 8 #include <Windows.h> |
9 #elif defined(__APPLE__) | 9 #elif defined(__APPLE__) |
10 #include <mach-o/dyld.h> | 10 #include <mach-o/dyld.h> |
11 #else // Linux | 11 #else // Linux |
12 #include <linux/limits.h> | 12 #include <linux/limits.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 #endif // _WIN32 | 14 #endif // _WIN32 |
15 | 15 |
| 16 #include <string> |
| 17 |
16 #include "core/include/fxcrt/fx_system.h" | 18 #include "core/include/fxcrt/fx_system.h" |
17 | 19 |
18 // static | 20 // static |
19 bool PathService::EndsWithSeparator(const std::string& path) { | 21 bool PathService::EndsWithSeparator(const std::string& path) { |
20 return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR; | 22 return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR; |
21 } | 23 } |
22 | 24 |
23 // static | 25 // static |
24 bool PathService::GetExecutableDir(std::string* path) { | 26 bool PathService::GetExecutableDir(std::string* path) { |
25 // Get the current executable file path. | 27 // Get the current executable file path. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool PathService::GetTestFilePath(const std::string& file_name, | 94 bool PathService::GetTestFilePath(const std::string& file_name, |
93 std::string* path) { | 95 std::string* path) { |
94 if (!GetTestDataDir(path)) | 96 if (!GetTestDataDir(path)) |
95 return false; | 97 return false; |
96 | 98 |
97 if (!EndsWithSeparator(*path)) | 99 if (!EndsWithSeparator(*path)) |
98 path->push_back(PATH_SEPARATOR); | 100 path->push_back(PATH_SEPARATOR); |
99 path->append(file_name); | 101 path->append(file_name); |
100 return true; | 102 return true; |
101 } | 103 } |
OLD | NEW |