diff options
author | Max Horn | 2002-05-16 10:43:17 +0000 |
---|---|---|
committer | Max Horn | 2002-05-16 10:43:17 +0000 |
commit | 6982fe9e47c2c3e559a100c5cb1d8730277ef953 (patch) | |
tree | 17997e55a9ffe847f886b3cbf7a95970b60b5441 /saveload.cpp | |
parent | 5edf1e6d7f9ca5ce8fa4e6ded69adff61c60ab50 (diff) | |
download | scummvm-rg350-6982fe9e47c2c3e559a100c5cb1d8730277ef953.tar.gz scummvm-rg350-6982fe9e47c2c3e559a100c5cb1d8730277ef953.tar.bz2 scummvm-rg350-6982fe9e47c2c3e559a100c5cb1d8730277ef953.zip |
added 'savepath' option to config file (can be specified globally or for each game differently). A command line switch should eventually be added, too
svn-id: r4342
Diffstat (limited to 'saveload.cpp')
-rw-r--r-- | saveload.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/saveload.cpp b/saveload.cpp index 929d07393c..269e63312f 100644 --- a/saveload.cpp +++ b/saveload.cpp @@ -25,6 +25,7 @@ #include "sound/mididrv.h" #include "sound/imuse.h" #include "actor.h" +#include "config-file.h" struct SaveGameHeader { uint32 type; @@ -161,25 +162,31 @@ bool Scumm::loadState(int slot, bool compat) void Scumm::makeSavegameName(char *out, int slot, bool compatible) { -#ifndef _WIN32_WCE + const char *dir = NULL; -#if !defined(MACOS_CARBON) - const char *dir = getenv("SCUMMVM_SAVEPATH"); - if (dir == NULL) - dir = ""; +#ifdef _WIN32_WCE + dir = _gameDataPath; #else - const char *dir = ""; -#endif - /* snprintf should be used here, but it's not portable enough */ - sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot); + #if !defined(MACOS_CARBON) + dir = getenv("SCUMMVM_SAVEPATH"); + #endif -#else + // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config + if (!dir || dir[0] == 0) + dir = scummcfg->get("savepath"); - sprintf(out, "%s%s.%c%.2d", _gameDataPath, _exe_name, - compatible ? 'c' : 's', slot); + // If SCUMMVM_SAVEPATH was not specified, try to use general path from config + if (!dir || dir[0] == 0) + dir = scummcfg->get("savepath", "scummvm"); + // If no save path was specified, use no directory prefix + if (dir == NULL) + dir = ""; #endif + + // snprintf should be used here, but it's not portable enough + sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot); } bool Scumm::getSavegameName(int slot, char *desc) |