need to treat backup zips as files

This commit is contained in:
Rob Weber 2014-08-01 13:12:43 -05:00
parent 647bd8811b
commit 545843e949
2 changed files with 25 additions and 3 deletions

View File

@ -245,7 +245,7 @@ class XbmcBackup:
self.backupFiles(fileManager.getFiles(),self.xbmc_vfs, self.remote_vfs) self.backupFiles(fileManager.getFiles(),self.xbmc_vfs, self.remote_vfs)
#delete the temp zip file #delete the temp zip file
self.xbmc_vfs.rmdir(xbmc.translatePath(utils.data_dir() + zip_name)) self.xbmc_vfs.rmfile(xbmc.translatePath(utils.data_dir() + zip_name))
#remove old backups #remove old backups
self._rotateBackups() self._rotateBackups()
@ -387,7 +387,7 @@ class XbmcBackup:
if(self.restore_point.split('.')[-1] == 'zip'): if(self.restore_point.split('.')[-1] == 'zip'):
#delete the zip file and the extracted directory #delete the zip file and the extracted directory
self.xbmc_vfs.rmdir(xbmc.translatePath("special://temp/" + self.restore_point)) self.xbmc_vfs.rmfile(xbmc.translatePath("special://temp/" + self.restore_point))
self.xbmc_vfs.rmdir(self.remote_vfs.root_path) self.xbmc_vfs.rmdir(self.remote_vfs.root_path)
#call update addons to refresh everything #call update addons to refresh everything
@ -453,7 +453,13 @@ class XbmcBackup:
while(remove_num < (len(dirs) - total_backups) and not self.progressBar.checkCancel()): while(remove_num < (len(dirs) - total_backups) and not self.progressBar.checkCancel()):
self._updateProgress(utils.getString(30054) + " " + dirs[remove_num][1]) self._updateProgress(utils.getString(30054) + " " + dirs[remove_num][1])
utils.log("Removing backup " + dirs[remove_num][0]) utils.log("Removing backup " + dirs[remove_num][0])
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/")
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])
else:
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/")
remove_num = remove_num + 1 remove_num = remove_num + 1
def _createValidationFile(self): def _createValidationFile(self):

View File

@ -44,6 +44,9 @@ class Vfs:
def rmdir(self,directory): def rmdir(self,directory):
return True return True
def rmfile(self,aFile):
return True
def exists(self,aFile): def exists(self,aFile):
return True return True
@ -68,6 +71,9 @@ class XBMCFileSystem(Vfs):
def rmdir(self,directory): def rmdir(self,directory):
return xbmcvfs.rmdir(directory,True) return xbmcvfs.rmdir(directory,True)
def rmfile(self,aFile):
return xbmcvfs.delete(aFile)
def rename(self,aFile,newName): def rename(self,aFile,newName):
return xbmcvfs.rename(aFile, newName) return xbmcvfs.rename(aFile, newName)
@ -181,6 +187,16 @@ class DropboxFileSystem(Vfs):
#finally remove the root directory #finally remove the root directory
self.client.file_delete(directory) self.client.file_delete(directory)
return True
else:
return False
def rmFile(self,aFile):
aFile = self._fix_slashes(aFile)
if(self.client != None and self.exists(aFile)):
self.client.file_delete(aFile)
return True
else: else:
return False return False