Skip to content

Commit

Permalink
Try unlink, then remove
Browse files Browse the repository at this point in the history
  • Loading branch information
devcurmudgeon committed Jul 3, 2016
1 parent a7696d1 commit 0b19284
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ybd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@ def _process_tree(root, srcpath, destpath, actionfunc):
path = re.search('/.*$', re.search('tmp[^/]+/.*$',
destpath).group(0)).group(0)
app.config['new-overlaps'] += [path]
os.remove(destpath)
try:
os.unlink(destpath)
except:
try:
os.remove(destpath)
except:
shutil.rmtree(destpath)

# Ensure that the symlink target is a relative path
target = os.readlink(srcpath)
Expand Down

0 comments on commit 0b19284

Please sign in to comment.