Skip to content

Commit 59ddda1

Browse files
authored
Wierd steam shortcut bug part 3
1 parent c5d0445 commit 59ddda1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

faugus-launcher.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -1664,13 +1664,12 @@ def check_steam_shortcut(self, title):
16641664
with open(steam_shortcuts_path, 'rb') as f:
16651665
shortcuts = vdf.binary_load(f)
16661666
for game in shortcuts["shortcuts"].values():
1667-
if game["AppName"] == title:
1667+
if isinstance(game, dict) and "AppName" in game and game["AppName"] == title:
16681668
return True
16691669
return False
16701670
except SyntaxError:
16711671
return False
1672-
else:
1673-
return False
1672+
return False
16741673

16751674
def set_image_shortcut_icon(self, title, icons_path, icon_temp):
16761675

@@ -2384,7 +2383,7 @@ def add_game_to_steam(title, game_directory, icon, command):
23842383
# Check if the game already exists
23852384
existing_app_id = None
23862385
for app_id, game_info in shortcuts["shortcuts"].items():
2387-
if game_info["AppName"] == title:
2386+
if isinstance(game_info, dict) and "AppName" in game_info and game_info["AppName"] == title:
23882387
existing_app_id = app_id
23892388
break
23902389

@@ -2397,7 +2396,7 @@ def add_game_to_steam(title, game_directory, icon, command):
23972396
game_info["LaunchOptions"] = f'"{command}"'
23982397
else:
23992398
# Generate a new ID for the game
2400-
new_app_id = max([int(k) for k in shortcuts["shortcuts"].keys()] or [0]) + 1
2399+
new_app_id = max([int(k) for k in shortcuts["shortcuts"].keys() if k.isdigit()] or [0]) + 1
24012400

24022401
# Add the new game
24032402
shortcuts["shortcuts"][str(new_app_id)] = {
@@ -4391,14 +4390,12 @@ def check_steam_shortcut(self, title):
43914390
with open(steam_shortcuts_path, 'rb') as f:
43924391
shortcuts = vdf.binary_load(f)
43934392
for game in shortcuts["shortcuts"].values():
4394-
if game["AppName"] == title:
4393+
if isinstance(game, dict) and "AppName" in game and game["AppName"] == title:
43954394
return True
43964395
return False
43974396
except SyntaxError:
43984397
return False
4399-
else:
4400-
return False
4401-
4398+
return False
44024399

44034400
def on_entry_query_tooltip(self, widget, x, y, keyboard_mode, tooltip):
44044401
current_text = widget.get_text()

0 commit comments

Comments
 (0)