diff options
author | Max Horn | 2011-06-06 15:30:21 +0200 |
---|---|---|
committer | Max Horn | 2011-06-06 15:30:21 +0200 |
commit | c8475224221ed14590ad08929a1cadd6e8e3cc4e (patch) | |
tree | 54c3bd35cd63e81246b10ff9213217335f928118 /backends/platform/iphone | |
parent | afb06b51cceb96cf3ac2baae1f562c673114d108 (diff) | |
download | scummvm-rg350-c8475224221ed14590ad08929a1cadd6e8e3cc4e.tar.gz scummvm-rg350-c8475224221ed14590ad08929a1cadd6e8e3cc4e.tar.bz2 scummvm-rg350-c8475224221ed14590ad08929a1cadd6e8e3cc4e.zip |
BACKENDS: Add OSystem::getDefaultConfigFileName
This is used to provide default implementations for createConfigWriteStream
and createConfigReadStream, which can be used by most backends.
Note that backends can still override createConfigRead/WriteStream;
this could be useful if settings on some port are not stored in a
regular file (think 'Windows registry', for a hypothetical example).
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r-- | backends/platform/iphone/osys_main.cpp | 23 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.h | 3 |
2 files changed, 6 insertions, 20 deletions
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp index 75156b9544..d0a10d9edc 100644 --- a/backends/platform/iphone/osys_main.cpp +++ b/backends/platform/iphone/osys_main.cpp @@ -229,29 +229,16 @@ OSystem *OSystem_IPHONE_create() { return new OSystem_IPHONE(); } -Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() { +CCommon::String OSystem_IPHONE::getDefaultConfigFileName() { #ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); + Common::String path = iPhone_getDocumentsDir(); + path += "/Preferences"; + return path; #else - Common::FSNode file(SCUMMVM_PREFS_PATH); + return SCUMMVM_PREFS_PATH; #endif - return file.createReadStream(); } -Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() { -#ifdef IPHONE_OFFICIAL - char buf[256]; - strncpy(buf, iPhone_getDocumentsDir(), 256); - strncat(buf, "/Preferences", 256 - strlen(buf) ); - Common::FSNode file(buf); -#else - Common::FSNode file(SCUMMVM_PREFS_PATH); -#endif - return file.createWriteStream(); -} void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) { // Get URL of the Resource directory of the .app bundle diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 1ff87967a1..36b4b7356b 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -184,8 +184,7 @@ public: void startSoundsystem(); void stopSoundsystem(); - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); + virtual Common::String getDefaultConfigFileName(); protected: void internUpdateScreen(); |