From d18ed2960e821bb259e91a610bf9c6a33495bd86 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Thu, 22 Aug 2019 14:42:41 -0500 Subject: [PATCH] change exclude criteria. Regex was not matching in complex cases --- resources/lib/backup.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/lib/backup.py b/resources/lib/backup.py index 93387b8..e018a3e 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -10,6 +10,7 @@ from vfs import XBMCFileSystem,DropboxFileSystem,ZipFileSystem,GoogleDriveFilesy from progressbar import BackupProgressBar from resources.lib.guisettings import GuiSettingsManager from resources.lib.extractor import ZipExtractor +from __builtin__ import file def folderSort(aKey): result = aKey[0] @@ -560,10 +561,7 @@ class FileManager: file_ext = aDir.split('.')[-1] #check if directory is excluded - regex = re.compile(".*(" + aDir + ").*") - excludedCheck = [m.group(0) for l in self.exclude_dir for m in [regex.search(l)] if m] - - if(len(excludedCheck) == 0): + if(not any(dirPath.startswith(exDir) for exDir in self.exclude_dir)): self.addFile("-" + dirPath) @@ -603,7 +601,11 @@ class FileManager: filename = filename.decode('UTF-8') except UnicodeDecodeError: filename = filename.decode('ISO-8859-2') - + + #remove trailing slash + if(filename[-1] == '/' or filename[-1] == '\\'): + filename = filename[:-1] + #write the full remote path name of this file utils.log("Exclude File: " + filename) self.exclude_dir.append(filename)