diff options
author | Luper Rouch <luper.rouch@gmail.com> | 2013-02-09 16:34:33 +0100 |
---|---|---|
committer | Luper Rouch <luper.rouch@gmail.com> | 2013-02-09 16:34:33 +0100 |
commit | 01a349882e929d507605fb015c14be71006f854a (patch) | |
tree | fcb107abdb7dc550154fb5bb9881de458fdab8c0 | |
parent | 08e02ef848e9af19592bf4ba809dc7574592fff2 (diff) | |
download | dotfiles-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.py | 5 |
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)) |