diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c9ebf2d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python-envs.defaultEnvManager": "ms-python.python:system" +} \ No newline at end of file diff --git a/install_servive.bat b/install_servive.bat index fe6e392..6762d86 100644 --- a/install_servive.bat +++ b/install_servive.bat @@ -7,4 +7,5 @@ if %errorlevel% neq 0 ( schtasks /create /tn "FoxPro 2.6 Connectivity Kit ODBC Setup Disk Game Launcher Because It Fell Under My Desk" /tr "pythonw.exe \"%~dp0main.py\"" /sc onlogon /rl highest /f echo If there's no errors above, the install probably worked +echo You will need to re-login or start the process from process monitor to start the app pause \ No newline at end of file diff --git a/main.py b/main.py index 9947186..0dd79ee 100644 --- a/main.py +++ b/main.py @@ -3,7 +3,7 @@ import os import tomllib import psutil import win32api - +import tomli_w CONFIG_PATH = os.path.join(os.environ["APPDATA"], "FP26CKOSDGLBIFUMD", "library.toml") PAUSE_FILE = os.path.join(os.environ["APPDATA"], "FP26CKOSDGLBIFUMD", "pause") @@ -28,6 +28,11 @@ def stop_game(game_process): proc.terminate() +if not os.path.exists(CONFIG_PATH): + os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True) + with open(CONFIG_PATH, "wb") as f: + tomli_w.dump({"disks": {}}, f) + while True: if os.path.exists("A:\\"): disk_in = True diff --git a/setup_disks.py b/setup_disks.py index 6b152dc..bf145d4 100644 --- a/setup_disks.py +++ b/setup_disks.py @@ -143,7 +143,6 @@ def setup_disk(): print("Setup complete!") # that was painful print("Now, eject the disk and press any key to continue") questionary.press_any_key_to_continue().ask() - os.remove(PAUSE_FILE) CONFIG_PATH = os.path.join(os.environ["APPDATA"], "FP26CKOSDGLBIFUMD", "library.toml") @@ -152,11 +151,20 @@ PAUSE_FILE = os.path.join(os.environ["APPDATA"], "FP26CKOSDGLBIFUMD", "pause") print("Welcome to the floppy disk setup app!") while True: match questionary.select( - "Please choose an option:", ["Setup individual disk", "Bulk Setup", "Exit"] + "Please choose an option:", + [ + "Setup disk", + "Open config file (required to delete something)", + "Exit", + ], ).ask(): case "Exit": print("Goodbye!") break - case "Setup individual disk": + case "Setup disk": open(PAUSE_FILE, "w").close() setup_disk() + os.remove(PAUSE_FILE) + case "Open config file (required to delete something)": + print("Opening...") + os.startfile(CONFIG_PATH)