Commit af8f4f5d authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Fix build/config/ios/hardlink.py when output exists

shutil.rmtree fails if asked to delete a single file, so change
build/config/ios/hardlink.py to use os.unlink/shutil.rmtree based
on the output type (directory, file, symlink, ...).

Bug: none
Change-Id: I861c215e91b455e5b24f8159e162f21644a4bd47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390183
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803861}
parent 6c4b0e98
...@@ -46,8 +46,10 @@ def CreateHardlink(target, output): ...@@ -46,8 +46,10 @@ def CreateHardlink(target, output):
If output already exists, it is first removed. In all cases, the If output already exists, it is first removed. In all cases, the
parent directory containing output is created. parent directory containing output is created.
""" """
if os.path.exists(output): if os.path.isdir(output):
shutil.rmtree(output) shutil.rmtree(output)
elif os.path.exists(output):
os.unlink(output)
parent_dir = os.path.dirname(os.path.abspath(output)) parent_dir = os.path.dirname(os.path.abspath(output))
if not os.path.isdir(parent_dir): if not os.path.isdir(parent_dir):
......
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