From 01e7d8278d6cd333a694448b56033b7a44c6b743 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 28 Jun 2024 23:39:11 -0700 Subject: [PATCH] Update NSLGameScanner.py --- NSLGameScanner.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 1c41041..fe42458 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -591,6 +591,7 @@ folder_names = { 'VK Play': 'VKPlayLauncher', } + # Iterate over each launcher in the folder_names dictionary for launcher_name, folder in folder_names.items(): # Define the current path of the folder @@ -612,8 +613,13 @@ for launcher_name, folder in folder_names.items(): # Check if the new path already exists if os.path.exists(new_path): - print(f'{new_path} already exists. Skipping renaming and symlinking.') - else: + # Check if the directory is empty + if not os.listdir(new_path): + print(f'{new_path} is empty. Deleting directory.') + os.rmdir(new_path) + else: + print(f'{new_path} already exists and is not empty. Skipping renaming and symlinking.') + continue # skip to the next iteration # Rename the folder os.rename(current_path, new_path) print(f"Renamed {current_path} to {new_path}")