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> | 16 #include <string> |
17 | 17 |
18 #include "core/fxcrt/include/fx_system.h" | 18 #include "core/fxcrt/fx_system.h" |
19 | 19 |
20 // static | 20 // static |
21 bool PathService::EndsWithSeparator(const std::string& path) { | 21 bool PathService::EndsWithSeparator(const std::string& path) { |
22 return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR; | 22 return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR; |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 bool PathService::GetExecutableDir(std::string* path) { | 26 bool PathService::GetExecutableDir(std::string* path) { |
27 // Get the current executable file path. | 27 // Get the current executable file path. |
28 #ifdef _WIN32 | 28 #ifdef _WIN32 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool PathService::GetTestFilePath(const std::string& file_name, | 94 bool PathService::GetTestFilePath(const std::string& file_name, |
95 std::string* path) { | 95 std::string* path) { |
96 if (!GetTestDataDir(path)) | 96 if (!GetTestDataDir(path)) |
97 return false; | 97 return false; |
98 | 98 |
99 if (!EndsWithSeparator(*path)) | 99 if (!EndsWithSeparator(*path)) |
100 path->push_back(PATH_SEPARATOR); | 100 path->push_back(PATH_SEPARATOR); |
101 path->append(file_name); | 101 path->append(file_name); |
102 return true; | 102 return true; |
103 } | 103 } |
OLD | NEW |