From 548c4e41ff42f64bfa3fadff730a67cab965beca Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sat, 22 Jun 2024 01:18:04 -0700 Subject: [PATCH] added skip check --- NSLGameScanner.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 3337369..4a22c91 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -557,14 +557,18 @@ for launcher_name, folder in folder_names.items(): # Define the new path of the folder new_path = os.path.join(compatdata_dir, str(appid)) - # Rename the folder - os.rename(current_path, new_path) + # Check if the new path already exists + if os.path.exists(new_path): + print(f'{new_path} already exists. Skipping renaming.') + else: + # Rename the folder + os.rename(current_path, new_path) - # Define the path of the symbolic link - symlink_path = os.path.join(compatdata_dir, folder) + # Define the path of the symbolic link + symlink_path = os.path.join(compatdata_dir, folder) - # Create a symbolic link to the renamed folder - os.symlink(new_path, symlink_path) + # Create a symbolic link to the renamed folder + os.symlink(new_path, symlink_path) else: print(f'{launcher_name}: {folder} does not exist')