Merge branch 'master' into matrix

This commit is contained in:
Rob Weber 2019-12-30 10:13:23 -06:00
commit 8bfef6692f
2 changed files with 14 additions and 11 deletions

View File

@ -395,7 +395,7 @@ class XbmcBackup:
for aFile in fileList: for aFile in fileList:
if(not self.progressBar.checkCancel()): if(not self.progressBar.checkCancel()):
if(utils.getSettingBool('verbose_logging')): if(utils.getSettingBool('verbose_logging')):
utils.log('Writing file: ' + aFile) utils.log('Writing file: ' + aFile['file'])
if(aFile['file'].startswith("-")): if(aFile['file'].startswith("-")):
self._updateProgress('%s remaining, writing %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):]) + "/")) self._updateProgress('%s remaining, writing %s' % (utils.diskString(self.transferLeft), os.path.basename(aFile['file'][len(source.root_path):]) + "/"))
@ -465,9 +465,9 @@ class XbmcBackup:
if(dirs[remove_num][0].split('.')[-1] == 'zip'): if(dirs[remove_num][0].split('.')[-1] == 'zip'):
# this is a file, remove it that way # this is a file, remove it that way
self.remote_vfs.rmfile(self.remote_base_path + dirs[remove_num][0]) self.remote_vfs.rmfile(self.remote_vfs.clean_path(self.remote_base_path) + dirs[remove_num][0])
else: else:
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/") self.remote_vfs.rmdir(self.remote_vfs.clean_path(self.remote_base_path) + dirs[remove_num][0] + "/")
remove_num = remove_num + 1 remove_num = remove_num + 1

View File

@ -17,16 +17,19 @@ class Vfs:
def __init__(self, rootString): def __init__(self, rootString):
self.set_root(rootString) self.set_root(rootString)
def clean_path(self, path):
# fix slashes
path = path.replace("\\", "/")
# check if trailing slash is included
if(path[-1:] != '/'):
path = path + '/'
return path
def set_root(self, rootString): def set_root(self, rootString):
old_root = self.root_path old_root = self.root_path
self.root_path = rootString self.root_path = self.clean_path(rootString)
# fix slashes
self.root_path = self.root_path.replace("\\", "/")
# check if trailing slash is included
if(self.root_path[-1:] != "/"):
self.root_path = self.root_path + "/"
# return the old root # return the old root
return old_root return old_root