mirror of
1
0
Fork 0

Fix bug when backup folder didn't exist

This commit is contained in:
Jonas De 2019-08-16 18:49:13 +02:00
parent 49e3a325bd
commit 56567cab22
1 changed files with 5 additions and 2 deletions

View File

@ -161,7 +161,10 @@ class Link(dotbot.Plugin):
fullpath = os.path.expanduser(path)
if backup:
basename = os.path.basename(fullpath)
backup = os.path.join(os.path.expanduser(backup), basename)
backup_dir = os.path.expanduser(backup)
if not os.path.exists(backup_dir):
os.makedirs(backup_dir)
backup = os.path.join(backup_dir, basename)
if relative:
source = self._relative_path(source, fullpath)
@ -176,7 +179,7 @@ class Link(dotbot.Plugin):
if os.path.isdir(fullpath):
if backup:
self._log.lowinfo('Backing up %s -> %s' % (fullpath, backup))
shutil.copytree(fullpath, backup+'/'+)
shutil.copytree(fullpath, backup)
shutil.rmtree(fullpath)
removed = True
else: