From 79e84df5819838daae188ebe5cf6d058cfa73a7d Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sat, 22 Jun 2024 04:36:20 -0700 Subject: [PATCH] Update NSLGameScanner.py --- NSLGameScanner.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index ddc0c81..9253e17 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -609,21 +609,24 @@ if app_ids and os.path.exists(non_steam_launchers_path): print("NonSteamLaunchers exists at the current path.") # Define the new path of the NonSteamLaunchers folder new_path = os.path.join(compatdata_dir, str(first_app_id)) - print(f"New path for NonSteamLaunchers: {new_path}") - # Move the NonSteamLaunchers folder to the new path - shutil.move(current_path, new_path) - print(f"Moved NonSteamLaunchers folder to {new_path}") + # Check if the new path already exists + if os.path.exists(new_path): + print(f'{new_path} already exists. Skipping renaming and symlinking.') + else: + # Move the NonSteamLaunchers folder to the new path + shutil.move(current_path, new_path) + print(f"Moved NonSteamLaunchers folder to {new_path}") - # Define the path of the symbolic link - symlink_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') - print(f"Symlink path for NonSteamLaunchers: {symlink_path}") + # Define the path of the symbolic link + symlink_path = os.path.join(compatdata_dir, 'NonSteamLaunchers') - # Create a symbolic link to the renamed NonSteamLaunchers folder - os.symlink(new_path, symlink_path) - print(f"Created symlink at {symlink_path} to {new_path}") + # Create a symbolic link to the renamed NonSteamLaunchers folder + os.symlink(new_path, symlink_path) + print(f"Created symlink at {symlink_path} to {new_path}") else: print(f"The directory {current_path} does not exist. Skipping.") + #End of old refactored Code