1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-12 19:20:12 +00:00
This commit is contained in:
deadc0de6
2021-04-29 15:54:35 +02:00
parent 4f19dc790c
commit c80ea1a4f2

View File

@@ -150,16 +150,12 @@ class Importer:
self.log.sub('\"{}\" imported'.format(path)) self.log.sub('\"{}\" imported'.format(path))
return 1 return 1
def _prepare_hierarchy(self, src, dst): def _prepare_hier_when_exists(self, srcf, dst):
"""prepare hierarchy for dotfile""" """a dotfile in dotpath already exists at that spot"""
srcf = os.path.join(self.dotpath, src) if not os.path.exists(srcf):
srcfd = os.path.dirname(srcf) return True
if self._ignore(srcf) or self._ignore(srcfd): if not self.safe:
return False return True
# a dotfile in dotpath already exists at that spot
if os.path.exists(srcf):
if self.safe:
cmp = Comparator(debug=self.debug, cmp = Comparator(debug=self.debug,
diff_cmd=self.diff_cmd) diff_cmd=self.diff_cmd)
diff = cmp.compare(srcf, dst) diff = cmp.compare(srcf, dst)
@@ -172,6 +168,17 @@ class Importer:
if not self.log.ask(msg.format(srcf)): if not self.log.ask(msg.format(srcf)):
return False return False
self.log.dbg('will overwrite existing file') self.log.dbg('will overwrite existing file')
return True
def _prepare_hierarchy(self, src, dst):
"""prepare hierarchy for dotfile"""
srcf = os.path.join(self.dotpath, src)
srcfd = os.path.dirname(srcf)
if self._ignore(srcf) or self._ignore(srcfd):
return False
if not self._prepare_hier_when_exists(srcf, dst):
return False
# create directory hierarchy # create directory hierarchy
if self.dry: if self.dry: