Fix MdpiAssetLocation check for Windows
_CheckAndroidNewMdpiAssetLocation assumes that path separators are '/'
so it fails to detect errors on Windows. This change changes the '/'
characters to path.sep to resolve this.
Bug: 1309977
Change-Id: Ib5ae333da7e58189cbf8cb8b042b22775f34e633
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3777285
Commit-Queue: Bruce Dawson <[email protected]>
Reviewed-by: Theresa Sullivan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1026787}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index d3aa385..35eb97d6 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -3593,9 +3593,10 @@
def _CheckAndroidNewMdpiAssetLocation(input_api, output_api):
"""Checks if MDPI assets are placed in a correct directory."""
- file_filter = lambda f: (f.LocalPath().endswith('.png') and
- ('/res/drawable/' in f.LocalPath() or
- '/res/drawable-ldrtl/' in f.LocalPath()))
+ file_filter = lambda f: (f.LocalPath().endswith(
+ '.png') and ('/res/drawable/'.replace('/', input_api.os_path.sep) in f.
+ LocalPath() or '/res/drawable-ldrtl/'.replace(
+ '/', input_api.os_path.sep) in f.LocalPath()))
errors = []
for f in input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter):