mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-17 23:05:11 -05:00
Merge pull request #1364 from abeloin/patch-backup_rmtree
Restore: Replace os.rmdir to shutil.rmtree
This commit is contained in:
commit
88dfea6549
@ -24,6 +24,7 @@ import socket
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import os.path
|
import os.path
|
||||||
|
import shutil
|
||||||
|
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
import sys
|
import sys
|
||||||
@ -638,7 +639,6 @@ def initialize(consoleLogging=True):
|
|||||||
if os.path.exists(restoreDir) and os.path.exists(os.path.join(restoreDir, 'cache')):
|
if os.path.exists(restoreDir) and os.path.exists(os.path.join(restoreDir, 'cache')):
|
||||||
def restoreCache(srcDir, dstDir):
|
def restoreCache(srcDir, dstDir):
|
||||||
import ntpath
|
import ntpath
|
||||||
import shutil
|
|
||||||
|
|
||||||
def path_leaf(path):
|
def path_leaf(path):
|
||||||
head, tail = ntpath.split(path)
|
head, tail = ntpath.split(path)
|
||||||
@ -659,7 +659,10 @@ def initialize(consoleLogging=True):
|
|||||||
logger.log(u"Restore: restoring cache failed: {0}".format(str(e)), logger.ERROR)
|
logger.log(u"Restore: restoring cache failed: {0}".format(str(e)), logger.ERROR)
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(os.path.join(DATA_DIR, 'restore')):
|
if os.path.exists(os.path.join(DATA_DIR, 'restore')):
|
||||||
os.rmdir(os.path.join(DATA_DIR, 'restore'))
|
try:
|
||||||
|
shutil.rmtree(os.path.join(DATA_DIR, 'restore'))
|
||||||
|
except Exception as e:
|
||||||
|
logger.log(u"Restore: Unable to remove the restore directory: {0}".format(str(e)), logger.ERROR)
|
||||||
|
|
||||||
# clean cache folders
|
# clean cache folders
|
||||||
if CACHE_DIR:
|
if CACHE_DIR:
|
||||||
|
Loading…
Reference in New Issue
Block a user