stuff
This commit is contained in:
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"python-envs.defaultEnvManager": "ms-python.python:system"
|
||||
}
|
||||
@@ -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
|
||||
7
main.py
7
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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user