Optimized cleanup for encryption

This commit is contained in:
2022-12-14 00:31:46 +01:00
parent a0c17c9fd6
commit 09bb6d1e31
3 changed files with 39 additions and 7 deletions

View File

@@ -4,13 +4,16 @@ class Cleanup():
def __init__(self,cli,paths):
self.cli = cli
self.paths = paths
def getAllFilePaths(self,file_type):
all_file_paths = [
def getMetaFilePaths(self,file_type):
return [
self.paths.getGroupFilesFolderPath(file_type),
self.paths.getUserFilesPath(file_type),
self.paths.getAccumulatedFilePath(file_type)
]
]
def getAllFilePaths(self,file_type):
all_file_paths = self.getMetaFilePaths(file_type)
if file_type == Paths.TYPE_DECRYPTED:
all_file_paths.append(self.paths.getDecryptedMainDataStandartFolder())
return all_file_paths
@@ -32,6 +35,10 @@ class Cleanup():
pass
self.cleanupFiles(Paths.TYPE_DECRYPTED)
def cleanupMetaData(self,file_type):
for folder_path in self.getMetaFilePaths(file_type):
self.deleteAllFilesInFolder(folder_path)
def deleteAll(self):
self.cleanupFiles(Paths.TYPE_ENCRYPTED)
self.cleanupFiles(Paths.TYPE_DECRYPTED)