Dan Albert 0f34946127 Restructure save games into a zipped bundle.
This is the first step toward bundling all assets related to a save game
into a single item. That makes it easier to avoid clobbering "temporary"
assets from other games like the state.json, but also makes it easier
for players to file bug reports, since there's only a single asset to
upload.

This is only the first step because so far it only includes the various
save files: start of turn, end of last turn before results processing,
and "latest" (the game saved explicitly by the player).
2023-01-16 13:59:16 -08:00

27 lines
630 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 save_dir() -> Path:
return Path(base_path()) / "Liberation" / "Saves"
def mission_path_for(name: str) -> Path:
return Path(base_path()) / "Missions" / name