diff --git a/NSLGameScanner.py b/NSLGameScanner.py index dbe42aa..97fb168 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -387,6 +387,15 @@ print(sys.path) # Create an empty dictionary to store the app IDs app_ids = {} +# Get the highest existing key +if shortcuts['shortcuts']: + highest_key = max(int(key) for key in shortcuts['shortcuts'].keys()) +else: + highest_key = -1 + +# Start the counter from the next available number +counter = highest_key + 1 + def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): global new_shortcuts_added global shortcuts_updated @@ -396,6 +405,7 @@ def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): global gridp64 global logo64 global hero64 + global counter # Add this line to access the counter variable # Check if the launcher is installed if not shortcutdirectory or not appname or not launchoptions or not startingdir: @@ -456,14 +466,15 @@ def create_new_entry(shortcutdirectory, appname, launchoptions, startingdir): 'Logo': logo64, } # Add the new entry to the shortcuts dictionary and add proton - # Use the length of the shortcuts dictionary for the key - key = str(len(shortcuts['shortcuts'])) - shortcuts['shortcuts'][key] = new_entry + # Use the counter for the key + shortcuts['shortcuts'][str(counter)] = new_entry # Use the counter as the key decky_shortcuts[appname] = decky_entry print(f"Added new entry for {appname} to shortcuts.") new_shortcuts_added = True created_shortcuts.append(appname) + counter += 1 # Increment the counter after adding the new entry +