[Scummvm-cvs-logs] SF.net SVN: scummvm:[33389] scummvm/trunk/base/main.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Jul 29 02:54:28 CEST 2008


Revision: 33389
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33389&view=rev
Author:   fingolfin
Date:     2008-07-29 00:54:28 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
BASE: in runGame, do not set addDefaultDirectory() the game path before invoking createInstance() -- detectors must use FSNode for detection, not rely on File::open

Modified Paths:
--------------
    scummvm/trunk/base/main.cpp

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2008-07-29 00:50:12 UTC (rev 33388)
+++ scummvm/trunk/base/main.cpp	2008-07-29 00:54:28 UTC (rev 33389)
@@ -110,36 +110,9 @@
 
 // TODO: specify the possible return values here
 static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
-	Common::String gameDataPath(ConfMan.get("path"));
-	if (gameDataPath.empty()) {
-	} else if (gameDataPath.lastChar() != '/'
-#if defined(__MORPHOS__) || defined(__amigaos4__)
-					&& gameDataPath.lastChar() != ':'
-#endif
-					&& gameDataPath.lastChar() != '\\') {
-		gameDataPath += '/';
-		ConfMan.set("path", gameDataPath, Common::ConfigManager::kTransientDomain);
-	}
+	// Query  the game data path, for messages
+	Common::String path = ConfMan.hasKey("path") ? ConfMan.get("path") : ".";
 
-	// We add the game "path" to the file search path via File::addDefaultDirectory(),
-	// so that MD5-based detection will be able to properly find files with mixed case
-	// filenames.
-	// FIXME/TODO: Fingolfin still doesn't like this; if those MD5-based detectors used
-	// FSNodes instead of File::open, they wouldn't have to do this.
-	Common::String path;
-	if (ConfMan.hasKey("path")) {
-		path = ConfMan.get("path");
-		FilesystemNode dir(path);
-		if (!dir.isDirectory()) {
-			warning("Game directory does not exist (%s)", path.c_str());
-			return 0;
-		}
-	} else {
-		path = ".";
-		warning("No path was provided. Assuming the data files are in the current directory");
-	}
-	Common::File::addDefaultDirectory(path);
-
 	// Create the game engine
 	Engine *engine = 0;
 	PluginError err = (*plugin)->createInstance(&system, &engine);
@@ -181,15 +154,14 @@
 		system.setWindowCaption(caption.c_str());
 	}
 
-	if (ConfMan.hasKey("path"))
-		Common::File::addDefaultDirectory(ConfMan.get("path"));
-	else
-		Common::File::addDefaultDirectory(".");
+	// Add the game path to the directory search list
+	Common::File::addDefaultDirectory(path);
 
 	// Add extrapath (if any) to the directory search list
 	if (ConfMan.hasKey("extrapath"))
 		Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath"));
 
+	// If a second extrapath is specified on the app domain level, add that as well.
 	if (ConfMan.hasKey("extrapath", Common::ConfigManager::kApplicationDomain))
 		Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath", Common::ConfigManager::kApplicationDomain));
 


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