2023-10-08 09:12:14 +02:00
|
|
|
from PyQt6.QtCore import QDir
|
|
|
|
|
|
2025-04-25 08:23:10 +02:00
|
|
|
import mobase
|
|
|
|
|
|
2023-10-08 09:12:14 +02:00
|
|
|
|
|
|
|
|
class BasicLocalSavegames(mobase.LocalSavegames):
|
2026-01-11 14:15:29 +01:00
|
|
|
_game: mobase.IPluginGame
|
|
|
|
|
|
|
|
|
|
def __init__(self, game: mobase.IPluginGame):
|
2023-10-08 09:12:14 +02:00
|
|
|
super().__init__()
|
2026-01-11 14:15:29 +01:00
|
|
|
self._game = game
|
|
|
|
|
|
|
|
|
|
def game_save_dir(self) -> str:
|
|
|
|
|
return self._game.savesDirectory().absolutePath()
|
2023-10-08 09:12:14 +02:00
|
|
|
|
|
|
|
|
def mappings(self, profile_save_dir: QDir):
|
|
|
|
|
return [
|
|
|
|
|
mobase.Mapping(
|
|
|
|
|
source=profile_save_dir.absolutePath(),
|
2026-01-11 14:15:29 +01:00
|
|
|
destination=self.game_save_dir(),
|
2023-10-08 09:12:14 +02:00
|
|
|
is_directory=True,
|
|
|
|
|
create_target=True,
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def prepareProfile(self, profile: mobase.IProfile) -> bool:
|
|
|
|
|
return profile.localSavesEnabled()
|