[Scummvm-cvs-logs] SF.net SVN: scummvm: [25490] scummvm/trunk/engines/sword2/sword2.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Feb 11 14:02:51 CET 2007
Revision: 25490
http://scummvm.svn.sourceforge.net/scummvm/?rev=25490&view=rev
Author: fingolfin
Date: 2007-02-11 05:02:50 -0800 (Sun, 11 Feb 2007)
Log Message:
-----------
SWORD2: Enhance the detector to recurse into the 'clusters' directory, making it possible to detect & run BS2 from (a straight copy of) the CD
Modified Paths:
--------------
scummvm/trunk/engines/sword2/sword2.cpp
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2007-02-11 11:47:05 UTC (rev 25489)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2007-02-11 13:02:50 UTC (rev 25490)
@@ -84,6 +84,7 @@
GameList Engine_SWORD2_detectGames(const FSList &fslist) {
GameList detectedGames;
const Sword2::GameSettings *g;
+ FSList::const_iterator file;
// TODO: It would be nice if we had code here which distinguishes
// between the 'sword2' and 'sword2demo' targets. The current code
@@ -91,7 +92,7 @@
for (g = Sword2::sword2_settings; g->gameid; ++g) {
// Iterate over all files in the given directory
- for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ for (file = fslist.begin(); file != fslist.end(); ++file) {
if (!file->isDirectory()) {
const char *fileName = file->name().c_str();
@@ -103,6 +104,30 @@
}
}
}
+
+
+ if (detectedGames.empty()) {
+ // Nothing found -- try to recurse into the 'clusters' subdirectory,
+ // present e.g. if the user copied the data straight from CD.
+ for (file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory()) {
+ const char *fileName = file->name().c_str();
+
+ if (0 == scumm_stricmp("clusters", fileName)) {
+ FSList recList;
+ if (file->listDir(recList, FilesystemNode::kListAll)) {
+ GameList recGames(Engine_SWORD2_detectGames(recList));
+ if (!recGames.empty()) {
+ detectedGames.push_back(recGames);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+
return detectedGames;
}
@@ -112,7 +137,7 @@
FSList fslist;
FilesystemNode dir(ConfMan.get("path"));
- if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ if (!dir.listDir(fslist, FilesystemNode::kListAll)) {
return kInvalidPathError;
}
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