mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
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).
27 lines
630 B
Python
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
|