Fix bug when backup folder didn't exist
This commit is contained in:
parent
49e3a325bd
commit
56567cab22
|
@ -161,7 +161,10 @@ class Link(dotbot.Plugin):
|
||||||
fullpath = os.path.expanduser(path)
|
fullpath = os.path.expanduser(path)
|
||||||
if backup:
|
if backup:
|
||||||
basename = os.path.basename(fullpath)
|
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:
|
if relative:
|
||||||
source = self._relative_path(source, fullpath)
|
source = self._relative_path(source, fullpath)
|
||||||
|
@ -176,7 +179,7 @@ class Link(dotbot.Plugin):
|
||||||
if os.path.isdir(fullpath):
|
if os.path.isdir(fullpath):
|
||||||
if backup:
|
if backup:
|
||||||
self._log.lowinfo('Backing up %s -> %s' % (fullpath, backup))
|
self._log.lowinfo('Backing up %s -> %s' % (fullpath, backup))
|
||||||
shutil.copytree(fullpath, backup+'/'+)
|
shutil.copytree(fullpath, backup)
|
||||||
shutil.rmtree(fullpath)
|
shutil.rmtree(fullpath)
|
||||||
removed = True
|
removed = True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue