diff options
author | Max Horn | 2008-09-07 22:10:58 +0000 |
---|---|---|
committer | Max Horn | 2008-09-07 22:10:58 +0000 |
commit | 2bc093828f0c626c7dd57f9cb300284b8563e411 (patch) | |
tree | db05cf763dd73e0f413648e7b62863b104af220b | |
parent | 3c48fb7eaec11a81ee90577ee2e94bfa209aee69 (diff) | |
download | scummvm-rg350-2bc093828f0c626c7dd57f9cb300284b8563e411.tar.gz scummvm-rg350-2bc093828f0c626c7dd57f9cb300284b8563e411.tar.bz2 scummvm-rg350-2bc093828f0c626c7dd57f9cb300284b8563e411.zip |
Replaced Engine::_gameDataPath (a String) by Engine::_gameDataDir (an FSNode); adapted code to that (by using getChild() to get subdirs, not string concatenation
svn-id: r34434
-rw-r--r-- | engines/agos/agos.cpp | 24 | ||||
-rw-r--r-- | engines/engine.cpp | 14 | ||||
-rw-r--r-- | engines/engine.h | 4 | ||||
-rw-r--r-- | engines/m4/m4.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 2 | ||||
-rw-r--r-- | engines/saga/saga.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 24 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 16 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 12 |
10 files changed, 53 insertions, 59 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index ec496fd285..97d84e036c 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -506,24 +506,24 @@ AGOSEngine::AGOSEngine(OSystem *syst) // Add default file directories for Acorn version of // Simon the Sorcerer 1 - File::addDefaultDirectory(_gameDataPath + "execute"); - File::addDefaultDirectory(_gameDataPath + "EXECUTE"); + File::addDefaultDirectory(_gameDataDir.getChild("execute")); + File::addDefaultDirectory(_gameDataDir.getChild("EXECUTE")); // Add default file directories for Amiga/Macintosh // verisons of Simon the Sorcerer 2 - File::addDefaultDirectory(_gameDataPath + "voices"); - File::addDefaultDirectory(_gameDataPath + "VOICES"); + File::addDefaultDirectory(_gameDataDir.getChild("voices")); + File::addDefaultDirectory(_gameDataDir.getChild("VOICES")); // Add default file directories for Amiga & Macintosh // versions of The Feeble Files - File::addDefaultDirectory(_gameDataPath + "gfx"); - File::addDefaultDirectory(_gameDataPath + "GFX"); - File::addDefaultDirectory(_gameDataPath + "movies"); - File::addDefaultDirectory(_gameDataPath + "MOVIES"); - File::addDefaultDirectory(_gameDataPath + "sfx"); - File::addDefaultDirectory(_gameDataPath + "SFX"); - File::addDefaultDirectory(_gameDataPath + "speech"); - File::addDefaultDirectory(_gameDataPath + "SPEECH"); + File::addDefaultDirectory(_gameDataDir.getChild("gfx")); + File::addDefaultDirectory(_gameDataDir.getChild("GFX")); + File::addDefaultDirectory(_gameDataDir.getChild("movies")); + File::addDefaultDirectory(_gameDataDir.getChild("MOVIES")); + File::addDefaultDirectory(_gameDataDir.getChild("sfx")); + File::addDefaultDirectory(_gameDataDir.getChild("SFX")); + File::addDefaultDirectory(_gameDataDir.getChild("speech")); + File::addDefaultDirectory(_gameDataDir.getChild("SPEECH")); syst->getEventManager()->registerRandomSource(_rnd, "agos"); } diff --git a/engines/engine.cpp b/engines/engine.cpp index 2c6df225e5..1d3368b10d 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -56,15 +56,7 @@ Engine::Engine(OSystem *syst) _eventMan(_system->getEventManager()), _saveFileMan(_system->getSavefileManager()), _targetName(ConfMan.getActiveDomainName()), - - // FIXME: Temporary workaround for "missing" slashes at the end - // of _gameDataPath. This can go once we completed the transition - // to the new Archive/SearchPath system. See also bug #2098279. -#ifdef __SYMBIAN32__ - _gameDataPath(ConfMan.get("path")), -#else - _gameDataPath(ConfMan.get("path") + '/'), -#endif + _gameDataDir(ConfMan.get("path")), _pauseLevel(0), _mainMenuDialog(NULL) { @@ -158,12 +150,12 @@ void Engine::checkCD() { char buffer[MAXPATHLEN]; int i; - if (strlen(_gameDataPath.c_str()) == 0) { + if (_gameDataDir.getPath().empty()) { // That's it! I give up! if (getcwd(buffer, MAXPATHLEN) == NULL) return; } else - strncpy(buffer, _gameDataPath.c_str(), MAXPATHLEN); + strncpy(buffer, _gameDataDir.getPath().c_str(), MAXPATHLEN); for (i = 0; i < MAXPATHLEN - 1; i++) { if (buffer[i] == '\\') diff --git a/engines/engine.h b/engines/engine.h index a8e759e274..81e4e6187c 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -26,6 +26,7 @@ #define ENGINES_ENGINE_H #include "common/events.h" +#include "common/fs.h" #include "common/scummsys.h" #include "common/str.h" @@ -60,7 +61,8 @@ protected: virtual int runDialog(Dialog &dialog); const Common::String _targetName; // target name for saves - const Common::String _gameDataPath; + + const Common::FilesystemNode _gameDataDir; private: /** diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index e49d33acb0..44d7f653d1 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -107,7 +107,7 @@ M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc) : // FIXME _vm = this; - Common::File::addDefaultDirectory(_gameDataPath); + Common::File::addDefaultDirectory(_gameDataDir); Common::File::addDefaultDirectory("goodstuf"); // FIXME: This is nonsense Common::File::addDefaultDirectory("resource"); // FIXME: This is nonsense diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 03464d8a7e..828cb4d021 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -66,7 +66,7 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam // FIXME _vm = this; - Common::File::addDefaultDirectory( _gameDataPath ); + Common::File::addDefaultDirectory(_gameDataDir); Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level"); Common::addSpecialDebugLevel(kDebugParser, "parser", "Parser debug level"); diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 79e2fd9ac6..5ce5d6ab93 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -92,20 +92,20 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc) // The Linux version of Inherit the Earth puts all data files in an // 'itedata' sub-directory, except for voices.rsc - Common::File::addDefaultDirectory(_gameDataPath + "itedata/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("itedata")); // The Windows version of Inherit the Earth puts various data files in // other subdirectories. - Common::File::addDefaultDirectory(_gameDataPath + "graphics/"); - Common::File::addDefaultDirectory(_gameDataPath + "music/"); - Common::File::addDefaultDirectory(_gameDataPath + "sound/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("graphics")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("music")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("sound")); // The Multi-OS version puts the voices file in the root directory of // the CD. The rest of the data files are in game/itedata - Common::File::addDefaultDirectory(_gameDataPath + "game/itedata/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("game").getChild("itedata")); // Mac CD Wyrmkeep - Common::File::addDefaultDirectory(_gameDataPath + "patch/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("patch")); _displayClip.left = _displayClip.top = 0; syst->getEventManager()->registerRandomSource(_rnd, "saga"); diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 5160dd09e9..50e0d221ca 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -226,7 +226,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) { #ifdef MACOSX sprintf(buf, "Cannot find file: '%s'\nPlease insert disc %d.\nPress OK to retry, Quit to exit", filename, disknum); #else - sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nPress OK to retry, Quit to exit", filename, disknum, _gameDataPath.c_str()); + sprintf(buf, "Cannot find file: '%s'\nInsert disc %d into drive %s\nPress OK to retry, Quit to exit", filename, disknum, _gameDataDir.getPath().c_str()); #endif result = displayMessage("Quit", buf); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index e4a6859e21..40a6136628 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -913,20 +913,20 @@ int ScummEngine::init() { // Add default file directories. if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) { // This is for the Amiga version of Indy3/Loom/Maniac/Zak - File::addDefaultDirectory(_gameDataPath + "ROOMS/"); - File::addDefaultDirectory(_gameDataPath + "rooms/"); + File::addDefaultDirectory(_gameDataDir.getChild("ROOMS")); + File::addDefaultDirectory(_gameDataDir.getChild("rooms")); } if ((_game.platform == Common::kPlatformMacintosh) && (_game.version == 3)) { // This is for the Mac version of Indy3/Loom - File::addDefaultDirectory(_gameDataPath + "Rooms 1/"); - File::addDefaultDirectory(_gameDataPath + "Rooms 2/"); - File::addDefaultDirectory(_gameDataPath + "Rooms 3/"); + File::addDefaultDirectory(_gameDataDir.getChild("Rooms 1")); + File::addDefaultDirectory(_gameDataDir.getChild("Rooms 2")); + File::addDefaultDirectory(_gameDataDir.getChild("Rooms 3")); } #ifdef ENABLE_SCUMM_7_8 #ifdef MACOSX - if (_game.version == 8 && !memcmp(_gameDataPath.c_str(), "/Volumes/MONKEY3_", 17)) { + if (_game.version == 8 && !memcmp(_gameDataDir.getPath().c_str(), "/Volumes/MONKEY3_", 17)) { // Special case for COMI on Mac OS X. The mount points on OS X depend // on the volume name. Hence if playing from CD, we'd get a problem. // So if loading of a resource file fails, we fall back to the (fixed) @@ -943,16 +943,16 @@ int ScummEngine::init() { #endif if (_game.version == 8) { // This is for COMI - File::addDefaultDirectory(_gameDataPath + "RESOURCE/"); - File::addDefaultDirectory(_gameDataPath + "resource/"); + File::addDefaultDirectory(_gameDataDir.getChild("RESOURCE")); + File::addDefaultDirectory(_gameDataDir.getChild("resource")); } if (_game.version == 7) { // This is for Full Throttle & The Dig - File::addDefaultDirectory(_gameDataPath + "VIDEO/"); - File::addDefaultDirectory(_gameDataPath + "video/"); - File::addDefaultDirectory(_gameDataPath + "DATA/"); - File::addDefaultDirectory(_gameDataPath + "data/"); + File::addDefaultDirectory(_gameDataDir.getChild("VIDEO")); + File::addDefaultDirectory(_gameDataDir.getChild("video")); + File::addDefaultDirectory(_gameDataDir.getChild("DATA")); + File::addDefaultDirectory(_gameDataDir.getChild("data")); } #endif diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index ab6430d6fc..9b79f59a32 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -257,14 +257,14 @@ SwordEngine::SwordEngine(OSystem *syst) _features = 0; // Add default file directories - Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/"); - Common::File::addDefaultDirectory(_gameDataPath + "MUSIC/"); - Common::File::addDefaultDirectory(_gameDataPath + "SPEECH/"); - Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/"); - Common::File::addDefaultDirectory(_gameDataPath + "clusters/"); - Common::File::addDefaultDirectory(_gameDataPath + "music/"); - Common::File::addDefaultDirectory(_gameDataPath + "speech/"); - Common::File::addDefaultDirectory(_gameDataPath + "video/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("CLUSTERS")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("MUSIC")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("SPEECH")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("VIDEO")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("music")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("speech")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("video")); } SwordEngine::~SwordEngine() { diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index a171cc0c41..390db0d275 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -230,12 +230,12 @@ namespace Sword2 { Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) { // Add default file directories - Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/"); - Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/"); - Common::File::addDefaultDirectory(_gameDataPath + "VIDEO/"); - Common::File::addDefaultDirectory(_gameDataPath + "clusters/"); - Common::File::addDefaultDirectory(_gameDataPath + "sword2/"); - Common::File::addDefaultDirectory(_gameDataPath + "video/"); + Common::File::addDefaultDirectory(_gameDataDir.getChild("CLUSTERS")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("SWORD2")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("VIDEO")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("clusters")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("sword2")); + Common::File::addDefaultDirectory(_gameDataDir.getChild("video")); if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword2demo")) _features = GF_DEMO; |