mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 20:54:51 +00:00
properly handle compare dir and file
This commit is contained in:
@@ -35,6 +35,8 @@ class Comparator:
|
||||
if self.debug:
|
||||
self.log.dbg('is file')
|
||||
return self._comp_file(left, right, ignore)
|
||||
if self.debug:
|
||||
self.log.dbg('is directory')
|
||||
return self._comp_dir(left, right, ignore)
|
||||
|
||||
def _comp_file(self, left, right, ignore):
|
||||
@@ -57,6 +59,8 @@ class Comparator:
|
||||
if self.debug:
|
||||
self.log.dbg('ignoring diff {} and {}'.format(left, right))
|
||||
return ''
|
||||
if not os.path.isdir(right):
|
||||
return '\"{}\" is a file\n'.format(right)
|
||||
if self.debug:
|
||||
self.log.dbg('compare {} and {}'.format(left, right))
|
||||
ret = []
|
||||
@@ -83,7 +87,7 @@ class Comparator:
|
||||
rfile = os.path.join(right, i)
|
||||
short = os.path.basename(lfile)
|
||||
# file vs dir
|
||||
ret.append('different type: \"{}\"\n'.format(short))
|
||||
ret.append('=> different type: \"{}\"\n'.format(short))
|
||||
|
||||
# content is different
|
||||
funny = comp.diff_files
|
||||
|
||||
@@ -64,9 +64,11 @@ class Installer:
|
||||
# symlink loop
|
||||
self.log.err('dotfile points to itself: {}'.format(dst))
|
||||
return []
|
||||
isdir = os.path.isdir(src)
|
||||
if self.debug:
|
||||
self.log.dbg('install {} to {}'.format(src, dst))
|
||||
if os.path.isdir(src):
|
||||
self.log.dbg('is \"{}\" a directory: {}'.format(src, isdir))
|
||||
if isdir:
|
||||
return self._handle_dir(templater, src, dst, actions=actions,
|
||||
noempty=noempty)
|
||||
return self._handle_file(templater, src, dst,
|
||||
|
||||
Reference in New Issue
Block a user