Fix PathService::GetThirdPartyFilePath() to work in a Chromium build.
When running pdfium_embeddertests as part of a Chromium build, it tries
to use Chromium's //third_party directory instead of PDFium's. Fix this
by checking for the presence of the bigint sub-directory, which is
in PDFium's third_party dir and unlikely to be in its embedder's.
Change-Id: Ie3633c562eeef77e62d26c111e53bbc3a36dad75
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/91271
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/utils/path_service.cpp b/testing/utils/path_service.cpp
index 49af893..f63bcd1 100644
--- a/testing/utils/path_service.cpp
+++ b/testing/utils/path_service.cpp
@@ -179,7 +179,10 @@
std::string potential_path = *path;
potential_path.append("third_party");
- if (PathService::DirectoryExists(potential_path)) {
+
+ // Use third_party/bigint as a way to distinguish PDFium's vs. other's.
+ std::string bigint = potential_path + PATH_SEPARATOR + "bigint";
+ if (PathService::DirectoryExists(bigint)) {
*path = potential_path;
path->append(PATH_SEPARATOR + file_name);
return true;
@@ -191,6 +194,7 @@
potential_path.append("pdfium");
potential_path.push_back(PATH_SEPARATOR);
potential_path.append("third_party");
+ bigint = potential_path + PATH_SEPARATOR + "bigint";
if (PathService::DirectoryExists(potential_path)) {
*path = potential_path;
path->append(PATH_SEPARATOR + file_name);