Skip to content

Commit bf58339

Browse files
committed
Fix saveDirectory for EpicGames
1 parent dfd6462 commit bf58339

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

games/game_subnautica.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from __future__ import annotations
22

33
import fnmatch
4-
import os
54
from pathlib import Path
65

7-
import mobase
86
from PyQt6.QtCore import QDir
97

8+
import mobase
9+
1010
from ..basic_features import BasicModDataChecker, GlobPatterns
1111
from ..basic_features.basic_save_game_info import (
1212
BasicGameSaveGame,
@@ -100,10 +100,10 @@ class SubnauticaGame(BasicGame, mobase.IPluginFileMapper):
100100
)
101101
GameSavesDirectory = r"%GAME_PATH%\SNAppData\SavedGames"
102102

103-
_game_extra_save_paths = [
103+
_game_saves_directory_epic = (
104104
r"%USERPROFILE%\Appdata\LocalLow\Unknown Worlds"
105105
r"\Subnautica\Subnautica\SavedGames"
106-
]
106+
)
107107

108108
_forced_libraries = ["winhttp.dll"]
109109

@@ -157,14 +157,15 @@ def settings(self) -> list[mobase.PluginSetting]:
157157
)
158158
]
159159

160+
def savesDirectory(self) -> QDir:
161+
if self.is_epic():
162+
return QDir(self._game_saves_directory_epic)
163+
return super().savesDirectory()
164+
160165
def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]:
161166
return [
162-
BasicGameSaveGame(folder)
163-
for save_path in (
164-
folder.absolutePath(),
165-
*(os.path.expandvars(p) for p in self._game_extra_save_paths),
166-
)
167-
for folder in Path(save_path).glob("slot*")
167+
BasicGameSaveGame(path)
168+
for path in Path(folder.absolutePath()).glob("slot*")
168169
]
169170

170171
def executables(self) -> list[mobase.ExecutableInfo]:

0 commit comments

Comments
 (0)