mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
backported fix from Matrix branch for backup rotation issues with base path #163
This commit is contained in:
parent
9ae5545f6c
commit
fa6bdf43a4
@ -461,9 +461,9 @@ class XbmcBackup:
|
||||
|
||||
if(dirs[remove_num][0].split('.')[-1] == 'zip'):
|
||||
#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:
|
||||
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
|
||||
|
||||
|
@ -15,16 +15,19 @@ class Vfs:
|
||||
def __init__(self,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):
|
||||
old_root = self.root_path
|
||||
self.root_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 + "/"
|
||||
self.root_path = self.clean_path(rootString)
|
||||
|
||||
#return the old root
|
||||
return old_root
|
||||
|
Loading…
Reference in New Issue
Block a user