Skip to content

Commit

Permalink
counter
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy committed Jul 15, 2024
1 parent c95c4d0 commit b369197
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions NSLGameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,15 @@ def check_if_shortcut_exists(shortcut_id, display_name, exe_path, start_dir, lau
# 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
Expand All @@ -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:
Expand Down Expand Up @@ -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




Expand Down

0 comments on commit b369197

Please sign in to comment.