Commit b2e5772f authored by rbpotter's avatar rbpotter Committed by Commit Bot

WebUI: Fix autogenerated JS import paths on Windows

This allows running:
python polymer_test.py from tools\polymer to pass on Windows, and
prevents ..\js\paths\like\this.m.js, which cause a parsing error.

Bug: 965770
Change-Id: I23701cffeab4ef5bf7d61bb06307b6fe8a9e17e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715147Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680142}
parent 5e961649
......@@ -114,7 +114,8 @@ class Dependency:
return self.html_path_normalized
input_dir = os.path.relpath(os.path.dirname(self.html_file), _ROOT)
return os.path.normpath(os.path.join(input_dir, self.html_path))
return os.path.normpath(
os.path.join(input_dir, self.html_path)).replace("\\", "/")
def _to_js_normalized(self):
if re.match(POLYMER_V1_DIR, self.html_path_normalized):
......@@ -145,7 +146,8 @@ class Dependency:
return js_path
input_dir = os.path.relpath(os.path.dirname(self.html_file), _ROOT)
relpath = os.path.relpath(self.js_path_normalized, input_dir)
relpath = os.path.relpath(
self.js_path_normalized, input_dir).replace("\\", "/")
# Prepend "./" if |relpath| refers to a relative subpath, that is not "../".
# This prefix is required for JS Modules paths.
if not relpath.startswith('.'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment