From fdfedc6dd91d88e7bc654ee6e020f18f8c31adf2 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 21 Jun 2024 07:06:24 -0700 Subject: [PATCH] Update NSLGameScanner.py --- NSLGameScanner.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 1df763a..e0c21d7 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -597,13 +597,19 @@ if app_ids and os.path.exists(os.path.join(compatdata_dir, 'NonSteamLaunchers')) -# Print the existing shortcuts -print("Existing Shortcuts:") -for shortcut in shortcuts['shortcuts'].values(): - if shortcut.get('appname') is None: - print(f"AppID for {shortcut.get('AppName')}: {shortcut.get('appid')}") - else: - print(f"AppID for {shortcut.get('appname')}: {shortcut.get('appid')}") +#Print if any shorcuts exist +if 'shortcuts' in shortcuts: + print("Existing Shortcuts:") + for shortcut in shortcuts['shortcuts'].values(): + # Check if 'appname' or 'AppName' is not in shortcut + if shortcut.get('appname') is None and shortcut.get('AppName') is None: + continue # Skip this iteration if no shortcut key + elif shortcut.get('appname') is None: + print(f"AppID for {shortcut.get('AppName')}: {shortcut.get('appid')}") + else: + print(f"AppID for {shortcut.get('appname')}: {shortcut.get('appid')}") +else: + print("No shortcuts found.")