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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Nov 12 04:21:49 CET 2006


Revision: 24684
          http://svn.sourceforge.net/scummvm/?rev=24684&view=rev
Author:   fingolfin
Date:     2006-11-11 19:21:44 -0800 (Sat, 11 Nov 2006)

Log Message:
-----------
Print sensible messages if engine instantiation failed

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

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2006-11-12 03:02:20 UTC (rev 24683)
+++ scummvm/trunk/base/main.cpp	2006-11-12 03:21:44 UTC (rev 24684)
@@ -145,18 +145,19 @@
 
 	// We add it here, so MD5-based detection will be able to
 	// read mixed case files
+	Common::String path;
 	if (ConfMan.hasKey("path")) {
-		Common::String path(ConfMan.get("path"));
+		path = ConfMan.get("path");
 		FilesystemNode dir(path);
 		if (!dir.isDirectory()) {
 			warning("Game directory does not exist (%s)", path.c_str());
 			return 0;
 		}
-		Common::File::addDefaultDirectory(path);
 	} else {
+		path = ".";
 		warning("No path was provided. Assuming the data files are in the current directory");
-		Common::File::addDefaultDirectory(".");
 	}
+	Common::File::addDefaultDirectory(path);
 
 	// Create the game engine
 	Engine *engine = 0;
@@ -166,7 +167,24 @@
 		// TODO: Also take 'err' into consideration...
 		//GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!");
 		//alert.runModal();
-		warning("Failed to instantiate engine for target %s", ConfMan.getActiveDomainName().c_str());
+		const char *errMsg = 0;
+		switch (err) {
+		case kInvalidPathError:
+			errMsg = "Invalid game path";
+			break;
+		case kNoGameDataFoundError:
+			errMsg = "Unable to locate game data";
+			break;
+		default:
+			errMsg = "Unknown error";
+		}
+
+		warning("%s failed to instantiate engine: %s (target '%s', path '%s')",
+			plugin->getName(),
+			errMsg,
+			ConfMan.getActiveDomainName().c_str(),
+			path.c_str()
+			);
 		return 0;
 	}
 


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