diff options
author | Max Horn | 2008-08-04 17:17:37 +0000 |
---|---|---|
committer | Max Horn | 2008-08-04 17:17:37 +0000 |
commit | 92d6ee3d7611617abfe1c4cdcf3a838116c34c95 (patch) | |
tree | 03b23bff39b66646db1a52cf234462db3ec3beb7 | |
parent | 1ed65c1e2ef0ec0cd2de5e144e179218a7c4260d (diff) | |
download | scummvm-rg350-92d6ee3d7611617abfe1c4cdcf3a838116c34c95.tar.gz scummvm-rg350-92d6ee3d7611617abfe1c4cdcf3a838116c34c95.tar.bz2 scummvm-rg350-92d6ee3d7611617abfe1c4cdcf3a838116c34c95.zip |
Moved ConfMan.registerDefault calls for savepath to DefaultSaveFileManager (eventually, should be pushed into backends/platform/ code)
svn-id: r33614
-rw-r--r-- | backends/saves/default/default-saves.cpp | 44 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 2 | ||||
-rw-r--r-- | base/commandLine.cpp | 41 |
3 files changed, 46 insertions, 41 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 26dd55cec8..cd46c941f5 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -41,6 +41,50 @@ #include <sys/stat.h> #endif +#ifdef IPHONE +#include "backends/platform/iphone/osys_iphone.h" +#endif + +#ifdef UNIX +#ifdef MACOSX +#define DEFAULT_SAVE_PATH "Documents/ScummVM Savegames" +#else +#define DEFAULT_SAVE_PATH ".scummvm" +#endif +#elif defined(__SYMBIAN32__) +#define DEFAULT_SAVE_PATH "Savegames" +#elif defined(PALMOS_MODE) +#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved" +#endif + +DefaultSaveFileManager::DefaultSaveFileManager() { + // Register default savepath + // TODO: Remove this code here, and instead leave setting the + // default savepath to the ports using this class. +#ifdef DEFAULT_SAVE_PATH + char savePath[MAXPATHLEN]; +#if defined(UNIX) && !defined(IPHONE) + const char *home = getenv("HOME"); + if (home && *home && strlen(home) < MAXPATHLEN) { + snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH); + ConfMan.registerDefault("savepath", savePath); + } +#elif defined(__SYMBIAN32__) + strcpy(savePath, Symbian::GetExecutablePath()); + strcat(savePath, DEFAULT_SAVE_PATH); + strcat(savePath, "\\"); + ConfMan.registerDefault("savepath", savePath); +#elif defined (IPHONE) + ConfMan.registerDefault("savepath", OSystem_IPHONE::getSavePath()); + +#elif defined(PALMOS_MODE) + ConfMan.registerDefault("savepath", DEFAULT_SAVE_PATH); +#endif +#endif // #ifdef DEFAULT_SAVE_PATH +} + + + Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) { FilesystemNode savePath(getSavePath()); FSList savefiles; diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index f3e0ec5b35..d8c0b0ae43 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -34,6 +34,8 @@ */ class DefaultSaveFileManager : public Common::SaveFileManager { public: + DefaultSaveFileManager(); + virtual Common::StringList listSavefiles(const char *pattern); virtual Common::InSaveFile *openForLoading(const char *filename); virtual Common::OutSaveFile *openForSaving(const char *filename); diff --git a/base/commandLine.cpp b/base/commandLine.cpp index ea0e1465b6..84f2013ae9 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -34,22 +34,6 @@ #include "sound/mididrv.h" -#ifdef IPHONE -#include "backends/platform/iphone/osys_iphone.h" -#endif - -#ifdef UNIX -#ifdef MACOSX -#define DEFAULT_SAVE_PATH "Documents/ScummVM Savegames" -#else -#define DEFAULT_SAVE_PATH ".scummvm" -#endif -#elif defined(__SYMBIAN32__) -#define DEFAULT_SAVE_PATH "Savegames" -#elif defined(PALMOS_MODE) -#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved" -#endif - #define DETECTOR_TESTING_HACK namespace Base { @@ -181,9 +165,6 @@ void registerDefaults() { // Game specific ConfMan.registerDefault("path", ""); - ConfMan.registerDefault("savepath", ""); - -// ConfMan.registerDefault("amiga", false); ConfMan.registerDefault("platform", Common::kPlatformPC); ConfMan.registerDefault("language", "en"); ConfMan.registerDefault("subtitles", false); @@ -216,28 +197,6 @@ void registerDefaults() { ConfMan.registerDefault("alsa_port", "65:0"); #endif - // Register default savepath -#ifdef DEFAULT_SAVE_PATH - char savePath[MAXPATHLEN]; -#if defined(UNIX) && !defined(IPHONE) - const char *home = getenv("HOME"); - if (home && *home && strlen(home) < MAXPATHLEN) { - snprintf(savePath, MAXPATHLEN, "%s/%s", home, DEFAULT_SAVE_PATH); - ConfMan.registerDefault("savepath", savePath); - } -#elif defined(__SYMBIAN32__) - strcpy(savePath, Symbian::GetExecutablePath()); - strcat(savePath, DEFAULT_SAVE_PATH); - strcat(savePath, "\\"); - ConfMan.registerDefault("savepath", savePath); -#elif defined (IPHONE) - ConfMan.registerDefault("savepath", OSystem_IPHONE::getSavePath()); - -#elif defined(PALMOS_MODE) - ConfMan.registerDefault("savepath", DEFAULT_SAVE_PATH); -#endif -#endif // #ifdef DEFAULT_SAVE_PATH - ConfMan.registerDefault("record_mode", "none"); ConfMan.registerDefault("record_file_name", "record.bin"); ConfMan.registerDefault("record_temp_file_name", "record.tmp"); |