From b165c45ca4e7a847640af660cc7b5153c09b5e4c Mon Sep 17 00:00:00 2001 From: Morgan Harris Date: Wed, 11 Oct 2023 14:11:06 +1100 Subject: [PATCH] Stop deleting requirements.txt every time we start up this is making life really annoying for devs --- UVR.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/UVR.py b/UVR.py index 714e638..45b905a 100644 --- a/UVR.py +++ b/UVR.py @@ -2258,6 +2258,7 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk): DIRECTORIES = (BASE_PATH, VR_MODELS_DIR, MDX_MODELS_DIR, DEMUCS_MODELS_DIR, DEMUCS_NEWER_REPO_DIR) EXTENSIONS = (('.aes', '.txt', '.tmp')) + EXCEPTIONS = {'requirements.txt', 'demucs_models.txt'} try: if os.path.isfile(f"{current_patch}{application_extension}"): @@ -2267,11 +2268,11 @@ class MainWindow(TkinterDnD.Tk if is_dnd_compatible else tk.Tk): if os.path.isfile(SPLASH_DOC): os.remove(SPLASH_DOC) - for dir in DIRECTORIES: - for temp_file in os.listdir(dir): - if temp_file.endswith(EXTENSIONS): - if os.path.isfile(os.path.join(dir, temp_file)): - os.remove(os.path.join(dir, temp_file)) + for directory in DIRECTORIES: + for temp_file in os.listdir(directory): + if temp_file.endswith(EXTENSIONS) and temp_file not in EXCEPTIONS: + if os.path.isfile(os.path.join(directory, temp_file)): + os.remove(os.path.join(directory, temp_file)) except Exception as e: self.error_log_var.set(error_text(TEMP_FILE_DELETION_TEXT, e))