Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: build/symlink.py

Issue 1222573002: Teach build/symlink.py --force to delete directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/symlink.py
diff --git a/build/symlink.py b/build/symlink.py
index aade2f865c7a18993dcf58d5aa68ea74464741fa..b88f1b65dc1ab7c2fd656155b2f0812f3fb46b19 100755
--- a/build/symlink.py
+++ b/build/symlink.py
@@ -9,6 +9,7 @@
import errno
import optparse
import os.path
+import shutil
import sys
@@ -29,7 +30,10 @@ def Main(argv):
os.symlink(s, t)
except OSError, e:
if e.errno == errno.EEXIST and options.force:
- os.remove(t)
+ if os.path.isdir(t):
+ shutil.rmtree(t, ignore_errors=True)
Nico 2015/07/01 18:26:43 Do you need this to work on Windows? shutil.rmtree
+ else:
+ os.remove(t)
os.symlink(s, t)
else:
raise
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698