Create records and savegames at user path (#250)

stable-5.1
Armin Burgmeier 2010-05-22 20:49:42 +02:00
parent 59f5ee646c
commit 99f0a43cff
3 changed files with 7 additions and 7 deletions

View File

@ -1961,14 +1961,14 @@ bool C4Game::QuickSave(const char *strFilename, const char *strTitle, bool fForc
SetWorkingDirectory(Config.General.ExePath);
// Create savegame folder
if (!Config.General.CreateSaveFolder(Config.General.SaveGameFolder.getData(), LoadResStr("IDS_GAME_SAVEGAMESTITLE")))
if (!Config.General.CreateSaveFolder(Config.AtUserDataPath(Config.General.SaveGameFolder.getData()), LoadResStr("IDS_GAME_SAVEGAMESTITLE")))
{ Log(LoadResStr("IDS_GAME_FAILSAVEGAME")); return false; }
// Create savegame subfolder(s)
char strSaveFolder[_MAX_PATH + 1];
for (uint32_t i = 0; i < SCharCount(DirectorySeparator, strFilename); i++)
{
SCopy(Config.General.SaveGameFolder.getData(), strSaveFolder); AppendBackslash(strSaveFolder);
SCopy(Config.AtUserDataPath(Config.General.SaveGameFolder.getData()), strSaveFolder); AppendBackslash(strSaveFolder);
SCopyUntil(strFilename, strSaveFolder + SLen(strSaveFolder), DirectorySeparator, _MAX_PATH, i);
if (!Config.General.CreateSaveFolder(strSaveFolder, strTitle))
{ Log(LoadResStr("IDS_GAME_FAILSAVEGAME")); return false; }
@ -1976,7 +1976,7 @@ bool C4Game::QuickSave(const char *strFilename, const char *strTitle, bool fForc
// Compose savegame filename
StdStrBuf strSavePath;
strSavePath.Format("%s%c%s", Config.General.SaveGameFolder.getData(), DirectorySeparator, strFilename);
strSavePath.Format("%s%c%s", Config.AtUserDataPath(Config.General.SaveGameFolder.getData()), DirectorySeparator, strFilename);
// Must not be the scenario file that is currently open
if (ItemIdentical(ScenarioFilename, strSavePath.getData()))

View File

@ -130,7 +130,7 @@ bool C4Record::Start(bool fInitial)
if (fRecording) return false;
// create demos folder
if (!Config.General.CreateSaveFolder(Config.General.SaveDemoFolder.getData(), LoadResStr("IDS_GAME_RECORDSTITLE")))
if (!Config.General.CreateSaveFolder(Config.AtUserDataPath(Config.General.SaveDemoFolder.getData()), LoadResStr("IDS_GAME_RECORDSTITLE")))
return false;
// various infos
@ -146,12 +146,12 @@ bool C4Record::Start(bool fInitial)
// determine index (by total number of records)
Index = 1;
for (DirectoryIterator i(Config.General.SaveDemoFolder.getData()); *i; ++i)
for (DirectoryIterator i(Config.AtUserDataPath(Config.General.SaveDemoFolder.getData())); *i; ++i)
if (WildcardMatch(C4CFN_ScenarioFiles, *i))
Index++;
// compose record filename
sFilename.Format("%s" DirSep "%03i-%s.c4s", sDemoFolder.getData(), Index, sScenName);
sFilename.Format("%s" DirSep "%03i-%s.c4s", Config.AtUserDataPath(sDemoFolder.getData()), Index, sScenName);
// log
StdStrBuf sLog; sLog.Format(LoadResStr("IDS_PRC_RECORDINGTO"),sFilename.getData());

View File

@ -475,7 +475,7 @@ bool C4MainMenu::ActivateSavegame(int32_t iPlayer)
// Compose commmand
strCommand.Format("Save:Game:%s:%s", strFilenameIndexed.getData(), strTitle.getData()); // Notice: the language title might contain ':' and thus confuse the segment list - but C4Menu::MenuCommand will try to handle this...
// Check free slot
strSavePath.Format("%s%c%s", Config.General.SaveGameFolder.getData(), DirectorySeparator, strFilenameIndexed.getData());
strSavePath.Format("%s%c%s", Config.AtUserDataPath(Config.General.SaveGameFolder.getData()), DirectorySeparator, strFilenameIndexed.getData());
bool fFree = !C4Group_IsGroup(strSavePath.getData());
// Item caption
strCaption = LoadResStr("IDS_MENU_CPSAVEGAME");