From a5dd4caa1c5781f84a7d49f77be355cba1a71f4a Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sat, 17 Apr 2021 20:45:56 +0200 Subject: [PATCH] properly handle update copy file for #307 --- dotdrop/updater.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dotdrop/updater.py b/dotdrop/updater.py index 1f5891e..3c8ff34 100644 --- a/dotdrop/updater.py +++ b/dotdrop/updater.py @@ -330,7 +330,12 @@ class Updater: blacklist.add(name) return blacklist - whitelist - shutil.copytree(exist, new, ignore=ig) + try: + shutil.copytree(exist, new, ignore=ig) + except OSError as e: + msg = 'error copying dir {}'.format(exist) + self.log.err('{}: {}'.format(msg, e)) + continue self.log.sub('\"{}\" dir added'.format(new)) # remove dirs that don't exist in deployed version @@ -384,7 +389,13 @@ class Updater: continue if self.debug: self.log.dbg('cp {} {}'.format(exist, new)) - shutil.copyfile(exist, new) + try: + shutil.copyfile(exist, new) + except OSError as e: + msg = 'error copying file {}'.format(exist) + self.log.err('{}: {}'.format(msg, e)) + continue + self._mirror_rights(exist, new) self.log.sub('\"{}\" added'.format(new))