Skip to content

Commit

Permalink
Made backups more robust
Browse files Browse the repository at this point in the history
Will now explicitly try to delete temporary backup folder, which would only already exist if a previous backup failed to complete / didn't get to moving the temp folder
  • Loading branch information
TheDuckCow committed Mar 31, 2018
1 parent f62e007 commit 266486f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions addon_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,19 @@ def create_backup(self):

if self._verbose: print("Backup destination path: ",local)

if os.path.isdir(local) == True:
if os.path.isdir(local):
try:
shutil.rmtree(local)
except:
if self._verbose:print("Failed to removed previous backup folder, contininuing")

# make the copy
# remove the temp folder; shouldn't exist but could if previously interrupted
if os.path.isdir(tempdest):
try:
shutil.rmtree(tempdest)
except:
if self._verbose:print("Failed to remove existing temp folder, contininuing")
# make the full addon copy, which temporarily places outside the addon folder
if self._backup_ignore_patterns != None:
shutil.copytree(
self._addon_root,tempdest,
Expand Down

0 comments on commit 266486f

Please sign in to comment.