Handle force creation of symlinked directories
Check if entry to force-create (delete) is a symlink and if so, simply unlink it. Don't try to run rmtree on the underlying directory, which will fail anyway.
This commit is contained in:
parent
aa06a18cff
commit
1a10f88c43
1 changed files with 3 additions and 1 deletions
|
@ -78,7 +78,9 @@ class Linker(Executor):
|
||||||
(self._exists(path) and not self._is_link(path))):
|
(self._exists(path) and not self._is_link(path))):
|
||||||
fullpath = os.path.expanduser(path)
|
fullpath = os.path.expanduser(path)
|
||||||
try:
|
try:
|
||||||
if os.path.isdir(fullpath):
|
if os.path.islink(fullpath):
|
||||||
|
os.unlink(fullpath)
|
||||||
|
elif os.path.isdir(fullpath):
|
||||||
shutil.rmtree(fullpath)
|
shutil.rmtree(fullpath)
|
||||||
else:
|
else:
|
||||||
os.remove(fullpath)
|
os.remove(fullpath)
|
||||||
|
|
Loading…
Reference in a new issue