diff --git a/dotdrop/comparator.py b/dotdrop/comparator.py index b516408..27cfa5f 100644 --- a/dotdrop/comparator.py +++ b/dotdrop/comparator.py @@ -43,6 +43,8 @@ class Comparator: def _comp_dir(self, left, right, ignore): """compare a directory""" + if not os.path.exists(right): + return '' if self._ignore([left, right], ignore): if self.debug: self.log.dbg('ignoring diff {} and {}'.format(left, right)) diff --git a/dotdrop/installer.py b/dotdrop/installer.py index 022dffb..132ac6a 100644 --- a/dotdrop/installer.py +++ b/dotdrop/installer.py @@ -36,6 +36,8 @@ class Installer: def install(self, templater, src, dst): """install the src to dst using a template""" src = os.path.join(self.base, os.path.expanduser(src)) + if not os.path.exists(src): + self.log.err('source dotfile does not exist: {}'.format(src)) dst = os.path.expanduser(dst) if self.totemp: dst = self._pivot_path(dst, self.totemp) @@ -52,6 +54,8 @@ class Installer: def link(self, templater, src, dst): """set src as the link target of dst""" src = os.path.join(self.base, os.path.expanduser(src)) + if not os.path.exists(src): + self.log.err('source dotfile does not exist: {}'.format(src)) dst = os.path.expanduser(dst) if self.totemp: return self.install(templater, src, dst) diff --git a/dotdrop/templategen.py b/dotdrop/templategen.py index 67408eb..af422bc 100644 --- a/dotdrop/templategen.py +++ b/dotdrop/templategen.py @@ -93,6 +93,8 @@ class Templategen: def is_template(path): """recursively check if any file is a template within path""" + if not os.path.exists(path): + return False if os.path.isfile(path): # is file return Templategen._is_template(path)