1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-10 10:24:17 +00:00

fix bug for #183

This commit is contained in:
deadc0de6
2019-08-15 10:26:47 +02:00
parent 621a4043d6
commit 614e32d89c

View File

@@ -178,6 +178,7 @@ class Installer:
dsts = [os.path.normpath(os.path.join(dst, child)) dsts = [os.path.normpath(os.path.join(dst, child))
for child in children] for child in children]
installed = 0
for i in range(len(children)): for i in range(len(children)):
src = srcs[i] src = srcs[i]
dst = dsts[i] dst = dsts[i]
@@ -196,17 +197,27 @@ class Installer:
continue continue
src = tmp src = tmp
result = self._link(src, dst, actionexec=actionexec) ret, err = self._link(src, dst, actionexec=actionexec)
if ret:
# void actionexec if dotfile installed installed += 1
# to prevent from running actions multiple times # void actionexec if dotfile installed
if len(result): # to prevent from running actions multiple times
actionexec = None actionexec = None
else:
if err:
return ret, err
return True, None return installed > 0, None
def _link(self, src, dst, actionexec=None): def _link(self, src, dst, actionexec=None):
"""set src as a link target of dst""" """
set src as a link target of dst
return
- True, None: success
- False, error_msg: error
- False, None, ignored
"""
overwrite = not self.safe overwrite = not self.safe
if os.path.lexists(dst): if os.path.lexists(dst):
if os.path.realpath(dst) == os.path.realpath(src): if os.path.realpath(dst) == os.path.realpath(src):