summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bazarr/check_update.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/bazarr/check_update.py b/bazarr/check_update.py
index 8f0d61a15..cd13314b2 100644
--- a/bazarr/check_update.py
+++ b/bazarr/check_update.py
@@ -194,16 +194,20 @@ def update_cleaner(zipfile, bazarr_dir, config_dir):
separator + '__pycache__' + separator + '$']
if os.path.abspath(bazarr_dir).lower() == os.path.abspath(config_dir).lower():
# for users who installed Bazarr inside the config directory (ie: `%programdata%\Bazarr` on windows)
- with os.scandir(config_dir) as directories:
- for directory in directories:
- if directory.is_dir():
- dir_to_ignore.append('^' + directory.name + os.path.sep)
+ dir_to_ignore.append('^backup' + separator)
+ dir_to_ignore.append('^cache' + separator)
+ dir_to_ignore.append('^config' + separator)
+ dir_to_ignore.append('^db' + separator)
+ dir_to_ignore.append('^log' + separator)
+ dir_to_ignore.append('^restore' + separator)
+ dir_to_ignore.append('^update' + separator)
elif os.path.abspath(bazarr_dir).lower() in os.path.abspath(config_dir).lower():
# when config directory is a child of Bazarr installation directory
- dir_to_ignore.append('^' + os.path.relpath(config_dir, bazarr_dir) + os.path.sep)
- dir_to_ignore_regex = re.compile('(?:% s)' % '|'.join(dir_to_ignore))
+ dir_to_ignore.append('^' + os.path.relpath(config_dir, bazarr_dir) + separator)
+ dir_to_ignore_regex_string = '(?:% s)' % '|'.join(dir_to_ignore)
logging.debug(f'BAZARR upgrade leftover cleaner will ignore directories matching this '
- f'regex: {dir_to_ignore_regex.pattern}')
+ f'regex: {dir_to_ignore_regex_string}')
+ dir_to_ignore_regex = re.compile(dir_to_ignore_regex_string)
file_to_ignore = ['nssm.exe', '7za.exe', 'unins000.exe', 'unins000.dat']
logging.debug('BAZARR upgrade leftover cleaner will ignore those files: {}'.format(', '.join(file_to_ignore)))