Commit 0b83aa28 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Preprocessing: Ensure all files are written under the preprocessing dir

This will prevent possible collisions, and ensures that files generated
by a target all live in that target's output.

Note that unpack_pak.py, previously used to create the folder of
preprocessed Web UI files, has an equivalent assert.

Bug: 1071641
Change-Id: Ic24e2a6c98cc35957c692bfa1a0d40fca1b7423e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424846
Auto-Submit: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809511}
parent 5b081495
...@@ -72,6 +72,8 @@ def main(argv): ...@@ -72,6 +72,8 @@ def main(argv):
out_path = os.path.join(out_folder, input_file) out_path = os.path.join(out_folder, input_file)
out_dir = os.path.dirname(out_path) out_dir = os.path.dirname(out_path)
assert out_dir.startswith(out_folder), \
'Cannot preprocess files to locations not under %s.' % out_dir
try: try:
os.makedirs(out_dir) os.makedirs(out_dir)
except OSError as e: except OSError as e:
......
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