diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-05-17 20:43:42 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-17 20:43:42 +0000 |
commit | dd8da5e2f0f4558d98a8a6f93f9cb14b5b091277 (patch) | |
tree | 84bfb5c6bbafbf35732441142acb9413cabad941 /testing/utils/path_service.cpp | |
parent | c524fc91aa42a8e34b4daf9a67fa283e25f48560 (diff) | |
download | pdfium-dd8da5e2f0f4558d98a8a6f93f9cb14b5b091277.tar.xz |
Add check that --font-dir is actually a directorychromium/3434
Hoisted myself on this today when I was actually passing the path to
the font file I wanted to use, not the directory.
BUG=pdfium:1008,pdfium:1020
Change-Id: I4a68a7d96633e951a92125d83397ff457288b1e0
Reviewed-on: https://pdfium-review.googlesource.com/32636
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'testing/utils/path_service.cpp')
-rw-r--r-- | testing/utils/path_service.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/testing/utils/path_service.cpp b/testing/utils/path_service.cpp index 2ded0ed3b1..5e1ce39602 100644 --- a/testing/utils/path_service.cpp +++ b/testing/utils/path_service.cpp @@ -35,7 +35,10 @@ int CallStat(const char* path, stat_wrapper_t* sb) { } #endif -bool DirectoryExists(const std::string& path) { +} // namespace + +// static +bool PathService::DirectoryExists(const std::string& path) { #ifdef _WIN32 DWORD fileattr = GetFileAttributesA(path.c_str()); if (fileattr != INVALID_FILE_ATTRIBUTES) @@ -49,8 +52,6 @@ bool DirectoryExists(const std::string& path) { #endif } -} // namespace - // static bool PathService::EndsWithSeparator(const std::string& path) { return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR; @@ -127,7 +128,7 @@ bool PathService::GetTestDataDir(std::string* path) { potential_path.append("testing"); potential_path.push_back(PATH_SEPARATOR); potential_path.append("resources"); - if (DirectoryExists(potential_path)) { + if (PathService::DirectoryExists(potential_path)) { *path = potential_path; return true; } @@ -140,7 +141,7 @@ bool PathService::GetTestDataDir(std::string* path) { potential_path.append("testing"); potential_path.push_back(PATH_SEPARATOR); potential_path.append("resources"); - if (DirectoryExists(potential_path)) { + if (PathService::DirectoryExists(potential_path)) { *path = potential_path; return true; } |