From 614e32d89ce5a31bf15f2582a6dae57c9dc8fc0e Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Thu, 15 Aug 2019 10:26:47 +0200 Subject: [PATCH] fix bug for #183 --- dotdrop/installer.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/dotdrop/installer.py b/dotdrop/installer.py index 74ccad6..413c3e2 100644 --- a/dotdrop/installer.py +++ b/dotdrop/installer.py @@ -178,6 +178,7 @@ class Installer: dsts = [os.path.normpath(os.path.join(dst, child)) for child in children] + installed = 0 for i in range(len(children)): src = srcs[i] dst = dsts[i] @@ -196,17 +197,27 @@ class Installer: continue src = tmp - result = self._link(src, dst, actionexec=actionexec) - - # void actionexec if dotfile installed - # to prevent from running actions multiple times - if len(result): + ret, err = self._link(src, dst, actionexec=actionexec) + if ret: + installed += 1 + # void actionexec if dotfile installed + # to prevent from running actions multiple times actionexec = None + else: + if err: + return ret, err - return True, None + return installed > 0, 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 if os.path.lexists(dst): if os.path.realpath(dst) == os.path.realpath(src):