summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Luper Rouch <luper.rouch@gmail.com> 2013-02-09 16:34:33 +0100
committerGravatar Luper Rouch <luper.rouch@gmail.com> 2013-02-09 16:34:33 +0100
commit01a349882e929d507605fb015c14be71006f854a (patch)
treefcb107abdb7dc550154fb5bb9881de458fdab8c0
parent08e02ef848e9af19592bf4ba809dc7574592fff2 (diff)
downloaddotfiles-01a349882e929d507605fb015c14be71006f854a.tar.gz
dotfiles-01a349882e929d507605fb015c14be71006f854a.tar.bz2
dotfiles-01a349882e929d507605fb015c14be71006f854a.zip
checking that the target directory exists before creating a symlink
-rw-r--r--dotfiles/core.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/dotfiles/core.py b/dotfiles/core.py
index 21c96fd..44fd978 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -12,7 +12,7 @@ import os.path
import shutil
import fnmatch
-from dotfiles.utils import realpath_expanduser, compare_path, is_link_to
+from dotfiles.utils import realpath_expanduser, is_link_to
from dotfiles.compat import symlink
@@ -42,6 +42,9 @@ class Dotfile(object):
def _symlink(self, target, name):
if not self.dry_run:
+ dirname = os.path.dirname(name)
+ if not os.path.isdir(dirname):
+ os.makedirs(dirname)
symlink(target, name)
else:
print("Creating symlink %s => %s" % (target, name))