From 01a349882e929d507605fb015c14be71006f854a Mon Sep 17 00:00:00 2001 From: Luper Rouch Date: Sat, 9 Feb 2013 16:34:33 +0100 Subject: checking that the target directory exists before creating a symlink --- dotfiles/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3