1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 04:45:39 +00:00

Changed string formatting, raise OSError instead of Exception, and catch it in link to skip the current dotfile

This commit is contained in:
moyiz
2017-05-05 16:33:55 +03:00
parent 6c6ce18d50
commit 6a178d746d
2 changed files with 14 additions and 11 deletions

View File

@@ -37,10 +37,10 @@ def get_tmpdir():
def remove(path):
''' Remove a file / directory / symlink '''
if not os.path.exists(path):
raise Exception("ERROR in remove: File not found: {}".format(path))
raise OSError("File not found: %s" % path)
if os.path.islink(path) or os.path.isfile(path):
os.unlink(path)
elif os.path.isdir(path):
rmtree(path)
else:
raise Exception("Unsupported file type for deletion: {}".format(path))
raise OSError("Unsupported file type for deletion: %s" % path)