mirror of
https://github.com/robweber/xbmcbackup.git
synced 2025-11-23 11:41:30 +01:00
added a clean path function and applied it to rotate backups
This commit is contained in:
@@ -17,16 +17,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
|
||||
|
||||
Reference in New Issue
Block a user