aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMax Horn2008-08-22 11:45:29 +0000
committerMax Horn2008-08-22 11:45:29 +0000
commit79751b07aef33512e2ded0867bbca0c50723f314 (patch)
tree44a809a4832074a6294217aa6ba726d837b46c0e /backends/platform
parenta237ba75bcb5a143cec73d2affaef23df7e64b7c (diff)
downloadscummvm-rg350-79751b07aef33512e2ded0867bbca0c50723f314.tar.gz
scummvm-rg350-79751b07aef33512e2ded0867bbca0c50723f314.tar.bz2
scummvm-rg350-79751b07aef33512e2ded0867bbca0c50723f314.zip
SDL backend: Simplified openConfigFileForReading/openConfigFileForWriting impl; also init _fsFactory in constructor, as it is needed to load the config file
svn-id: r34100
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl.cpp46
1 files changed, 17 insertions, 29 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 4ba53ffb5e..44ed5e45ff 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -170,21 +170,6 @@ void OSystem_SDL::initBackend() {
_timerID = SDL_AddTimer(10, &timer_handler, _timer);
}
- if (_fsFactory == 0) {
- #if defined(__amigaos4__)
- _fsFactory = new AmigaOSFilesystemFactory();
- #elif defined(UNIX)
- _fsFactory = new POSIXFilesystemFactory();
- #elif defined(WIN32)
- _fsFactory = new WindowsFilesystemFactory();
- #elif defined(__SYMBIAN32__)
- // Do nothing since its handled by the Symbian SDL inheritance
- #else
- #error Unknown and unsupported backend in OSystem_SDL::getFilesystemFactory
- #endif
- }
-
-
// Invoke parent implementation of this method
OSystem::initBackend();
@@ -229,6 +214,19 @@ OSystem_SDL::OSystem_SDL()
memset(&_mouseCurState, 0, sizeof(_mouseCurState));
_inited = false;
+
+
+ #if defined(__amigaos4__)
+ _fsFactory = new AmigaOSFilesystemFactory();
+ #elif defined(UNIX)
+ _fsFactory = new POSIXFilesystemFactory();
+ #elif defined(WIN32)
+ _fsFactory = new WindowsFilesystemFactory();
+ #elif defined(__SYMBIAN32__)
+ // Do nothing since its handled by the Symbian SDL inheritance
+ #else
+ #error Unknown and unsupported FS backend
+ #endif
}
OSystem_SDL::~OSystem_SDL() {
@@ -345,23 +343,13 @@ static Common::String getDefaultConfigFileName() {
}
Common::SeekableReadStream *OSystem_SDL::openConfigFileForReading() {
- Common::File *confFile = new Common::File();
- assert(confFile);
- if (!confFile->open(getDefaultConfigFileName())) {
- delete confFile;
- confFile = 0;
- }
- return confFile;
+ FilesystemNode file(getDefaultConfigFileName());
+ return file.openForReading();
}
Common::WriteStream *OSystem_SDL::openConfigFileForWriting() {
- Common::DumpFile *confFile = new Common::DumpFile();
- assert(confFile);
- if (!confFile->open(getDefaultConfigFileName())) {
- delete confFile;
- confFile = 0;
- }
- return confFile;
+ FilesystemNode file(getDefaultConfigFileName());
+ return file.openForWriting();
}
void OSystem_SDL::setWindowCaption(const char *caption) {