Add loading current track and config. Second part and fixes #2

This commit is contained in:
SemvdH
2025-11-22 00:35:32 +01:00
parent 808db12e25
commit 15c280b45e
3 changed files with 73 additions and 35 deletions

View File

@@ -42,8 +42,20 @@ def get_configs(track) -> list[str]:
configdirs.remove(s)
if (len(configdirs) == 0):
print("===== The map you entered does not have a config! =====")
config = ""
return configdirs
def get_current_track() -> tuple[str, str]:
track_name = ""
config_name = ""
config_file = os.path.join(CONFIG_PATH, CONFIG_FILE)
with open(config_file,'r') as file:
for line in file:
line = line.strip()
if line.startswith("TRACK="):
track_name = line.replace("TRACK=","").strip()
elif line.startswith("CONFIG_TRACK="):
config_name = line.replace("CONFIG_TRACK=","").strip()
return track_name, config_name
def change_track(newname, config=""):