[Scummvm-cvs-logs] SF.net SVN: scummvm:[34434] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Sep 8 00:10:59 CEST 2008


Revision: 34434
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34434&view=rev
Author:   fingolfin
Date:     2008-09-07 22:10:58 +0000 (Sun, 07 Sep 2008)

Log Message:
-----------
Replaced Engine::_gameDataPath (a String) by Engine::_gameDataDir (an FSNode); adapted code to that (by using getChild() to get subdirs, not string concatenation

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/engine.cpp
    scummvm/trunk/engines/engine.h
    scummvm/trunk/engines/m4/m4.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/scumm/resource.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/sword1/sword1.cpp
    scummvm/trunk/engines/sword2/sword2.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/agos/agos.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -506,24 +506,24 @@
 
 	// 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");
 }

Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/engine.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -56,15 +56,7 @@
 		_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 @@
 	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] == '\\')

Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/engine.h	2008-09-07 22:10:58 UTC (rev 34434)
@@ -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 @@
 	virtual int runDialog(Dialog &dialog);
 
 	const Common::String _targetName; // target name for saves
-	const Common::String _gameDataPath;
+	
+	const Common::FilesystemNode _gameDataDir;
 
 private:
 	/**

Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/m4/m4.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -107,7 +107,7 @@
 	// 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
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -66,7 +66,7 @@
 	// 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");

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/saga/saga.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -92,20 +92,20 @@
 
 	// 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");

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/scumm/resource.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -226,7 +226,7 @@
 #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);

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -913,20 +913,20 @@
 	// 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 @@
 #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
 

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -257,14 +257,14 @@
 		_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() {

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2008-09-07 22:00:04 UTC (rev 34433)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2008-09-07 22:10:58 UTC (rev 34434)
@@ -230,12 +230,12 @@
 
 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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list