Properly check for Windows path names in presubmit checks.
Use normpath() so all the paths used in comparisons have the correct
directory separators.
Bug: pdfium:1365
Change-Id: I4871f97c8c7d3d54528bd50be5de0bd96071b5a1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/57911
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/PRESUBMIT.py b/fpdfsdk/PRESUBMIT.py
index e844ec3..17f7c6a 100644
--- a/fpdfsdk/PRESUBMIT.py
+++ b/fpdfsdk/PRESUBMIT.py
@@ -8,13 +8,14 @@
for more details about the presubmit API built into depot_tools.
"""
-def _IsApiTestFile(affected_file):
- return affected_file.LocalPath() == 'fpdfsdk/fpdf_view_c_api_test.c'
-
-
def _CheckApiTestFile(input_api, output_api):
"""Checks that the public headers match the API tests."""
- if all([not _IsApiTestFile(f) for f in input_api.AffectedSourceFiles([])]):
+ api_test_file = input_api.os_path.normpath('fpdfsdk/fpdf_view_c_api_test.c')
+
+ def is_api_test_file(f):
+ return input_api.os_path.normpath(f.LocalPath()) == api_test_file
+
+ if all([not is_api_test_file(f) for f in input_api.AffectedSourceFiles([])]):
return []
src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath())