Dan Albert e2c6d6788c Persist some campaign creation options.
We should also persist mod options, but those will go in a separate file
because they aren't a part of Settings.

Plugins need some work before that can be saved here. They're not
configurable in the NGW currently, so that needs to be fixed first. It
also appears that it may not be safe to inject the settings object with
plugin options until the game is created, but that needs more
investigation (see the comment in Settings.save_player_settings).

Another obvious candidate would be the desired player mission duration,
but we need to implement custom serialization for that first.
2023-04-24 22:49:30 -07:00

32 lines
753 B
Python

from __future__ import annotations
from pathlib import Path
_dcs_saved_game_folder: Path | None = None
def set_dcs_save_game_directory(user_folder: Path) -> None:
global _dcs_saved_game_folder
_dcs_saved_game_folder = user_folder
if not save_dir().exists():
save_dir().mkdir(parents=True)
def base_path() -> str:
global _dcs_saved_game_folder
assert _dcs_saved_game_folder is not None
return str(_dcs_saved_game_folder)
def liberation_user_dir() -> Path:
"""The path to the Liberation user directory."""
return Path(base_path()) / "Liberation"
def save_dir() -> Path:
return liberation_user_dir() / "Saves"
def mission_path_for(name: str) -> Path:
return Path(base_path()) / "Missions" / name