mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 15:14:17 +00:00
ensure source dotfile exists
This commit is contained in:
@@ -43,6 +43,8 @@ class Comparator:
|
|||||||
|
|
||||||
def _comp_dir(self, left, right, ignore):
|
def _comp_dir(self, left, right, ignore):
|
||||||
"""compare a directory"""
|
"""compare a directory"""
|
||||||
|
if not os.path.exists(right):
|
||||||
|
return ''
|
||||||
if self._ignore([left, right], ignore):
|
if self._ignore([left, right], ignore):
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.log.dbg('ignoring diff {} and {}'.format(left, right))
|
self.log.dbg('ignoring diff {} and {}'.format(left, right))
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ class Installer:
|
|||||||
def install(self, templater, src, dst):
|
def install(self, templater, src, dst):
|
||||||
"""install the src to dst using a template"""
|
"""install the src to dst using a template"""
|
||||||
src = os.path.join(self.base, os.path.expanduser(src))
|
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)
|
dst = os.path.expanduser(dst)
|
||||||
if self.totemp:
|
if self.totemp:
|
||||||
dst = self._pivot_path(dst, self.totemp)
|
dst = self._pivot_path(dst, self.totemp)
|
||||||
@@ -52,6 +54,8 @@ class Installer:
|
|||||||
def link(self, templater, src, dst):
|
def link(self, templater, src, dst):
|
||||||
"""set src as the link target of dst"""
|
"""set src as the link target of dst"""
|
||||||
src = os.path.join(self.base, os.path.expanduser(src))
|
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)
|
dst = os.path.expanduser(dst)
|
||||||
if self.totemp:
|
if self.totemp:
|
||||||
return self.install(templater, src, dst)
|
return self.install(templater, src, dst)
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ class Templategen:
|
|||||||
|
|
||||||
def is_template(path):
|
def is_template(path):
|
||||||
"""recursively check if any file is a template within path"""
|
"""recursively check if any file is a template within path"""
|
||||||
|
if not os.path.exists(path):
|
||||||
|
return False
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
# is file
|
# is file
|
||||||
return Templategen._is_template(path)
|
return Templategen._is_template(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user