Skip to content

Commit

Permalink
Fix error popup when --launch-game is used
Browse files Browse the repository at this point in the history
  • Loading branch information
supercam19 committed Mar 24, 2024
1 parent 96d73ca commit a2f97eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gmutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
import subprocess
import sys

import customtkinter
import requests
Expand Down Expand Up @@ -45,7 +46,7 @@ def check_files():
# print("displayz.exe downloaded")
except Exception as e:
popup("Error", f"Could not download required file displayz.exe. Submit an issue to the GitHub if you believe this is a bug:\n\n {e}")
exit(0)
sys.exit(0)
if not os.path.isfile("settings.json"):
with open("settings.json", "w") as f:
f.write('{"default_monitor": 0, "games": []}')
Expand Down
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def launch_game(game_name):
time.sleep(2)
os.system(game_name)
set_monitor(default_monitor)
exit(0)
sys.exit(0)
else:
for game in games:
if game.get("name") == game_name:
Expand All @@ -265,7 +265,7 @@ def launch_game(game_name):
os.chdir(os.path.dirname(game.get('path')))
os.system(f"\"{game.get('process_name')}\"")
set_monitor(default_monitor)
exit(0)
sys.exit(0)


def load_games(window):
Expand Down Expand Up @@ -316,6 +316,8 @@ def main(open_window):
launch_game(sys.argv[i + 1])

main(show_on_startup)
except SystemExit:
pass
except Exception as e:
popup("Error", f"An error occurred. If you believe this to be a bug, please submit an issue at github.com/supercam19/GameMonitor/issues with the error message:\n\n{e}")

0 comments on commit a2f97eb

Please sign in to comment.