[Scummvm-git-logs] scummvm master -> 23d3d08a9128be11ca7ce134c4832453e7f89845

criezy criezy at scummvm.org
Sat Oct 29 19:08:24 CEST 2016


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
598407a425 BASE: Add --auto-detect command
d65f2b3821 BASE: Formatting code
5fd376d020 BASE: Auto-detect option now uses the specified path
23d3d08a91 README: Adding auto-detect command line option


Commit: 598407a42516fde44df8d3e5f9fac2f1800b1983
    https://github.com/scummvm/scummvm/commit/598407a42516fde44df8d3e5f9fac2f1800b1983
Author: iskrich (zebster26 at mail.ru)
Date: 2016-10-29T17:56:47+01:00

Commit Message:
BASE: Add --auto-detect command

Allows to display games in the current directory that are compatible with ScummVM.

This option enables the user to find games in the directory from which ScummVM was launched. In terminal it looks like:

--------------------------------------------------------------------------------------

$ scummvm --auto-detect

ID                   Description
-------------------- ---------------------------------------------------------
drascula             Drascula: The Vampire Strikes Back (DOS/English)
queen                Flight of the Amazon Queen (Talkie/DOS/English)

--------------------------------------------------------------------------------------

The current directory is defined as dir(".") then using EngineMan.detectGames to recognise games.

Changed paths:
    base/commandLine.cpp



diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 558c147..57a5893 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -68,6 +68,7 @@ static const char HELP_STRING[] =
 	"  -z, --list-games         Display list of supported games and exit\n"
 	"  -t, --list-targets       Display list of configured targets and exit\n"
 	"  --list-saves=TARGET      Display a list of saved games for the game (TARGET) specified\n"
+	"  --auto-detect            Display a list of games from current directory\n"
 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
 	"  --console                Enable the console window (default:enabled)\n"
 #endif
@@ -402,6 +403,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
 			DO_COMMAND('z', "list-games")
 			END_COMMAND
 
+			DO_LONG_COMMAND("auto-detect")
+			END_COMMAND
+
 #ifdef DETECTOR_TESTING_HACK
 			// HACK FIXME TODO: This command is intentionally *not* documented!
 			DO_LONG_COMMAND("test-detector")
@@ -771,6 +775,24 @@ static void listAudioDevices() {
 	}
 }
 
+/** Display all games in current directory */
+static void autoDetect(){
+	//Current directory
+	Common::FSNode dir(".");
+	Common::FSList files;
+	//Collect all files from directory
+	dir.getChildren(files, Common::FSNode::kListAll);
+	GameList candidates(EngineMan.detectGames(files));
+	if (candidates.empty()) {
+		printf("%s\n","ScummVM could not find any game in the current directory" );
+	} else {
+		printf("ID                   Description\n");
+		printf("-------------------- ---------------------------------------------------------\n");
+		for (GameList::iterator v = candidates.begin(); v != candidates.end(); ++v) {
+			printf("%-20s %s\n", v->gameid().c_str(), v->description().c_str());
+		}
+	}
+}
 
 #ifdef DETECTOR_TESTING_HACK
 static void runDetectorTest() {
@@ -997,6 +1019,9 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	} else if (command == "help") {
 		printf(HELP_STRING, s_appName);
 		return true;
+	} else if (command == "auto-detect"){
+		autoDetect();
+		return true;
 	}
 #ifdef DETECTOR_TESTING_HACK
 	else if (command == "test-detector") {


Commit: d65f2b38213c0dd3f60f3c3ab1290d111ad8efb3
    https://github.com/scummvm/scummvm/commit/d65f2b38213c0dd3f60f3c3ab1290d111ad8efb3
Author: iskrich (zebster26 at mail.ru)
Date: 2016-10-29T17:56:47+01:00

Commit Message:
BASE: Formatting code

Changed paths:
    base/commandLine.cpp



diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 57a5893..474a085 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -776,12 +776,16 @@ static void listAudioDevices() {
 }
 
 /** Display all games in current directory */
-static void autoDetect(){
+static void autoDetect() {
+
 	//Current directory
 	Common::FSNode dir(".");
+
 	Common::FSList files;
+
 	//Collect all files from directory
 	dir.getChildren(files, Common::FSNode::kListAll);
+
 	GameList candidates(EngineMan.detectGames(files));
 	if (candidates.empty()) {
 		printf("%s\n","ScummVM could not find any game in the current directory" );
@@ -1019,7 +1023,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	} else if (command == "help") {
 		printf(HELP_STRING, s_appName);
 		return true;
-	} else if (command == "auto-detect"){
+	} else if (command == "auto-detect") {
 		autoDetect();
 		return true;
 	}


Commit: 5fd376d0201267d72925f1eabc286682eb085497
    https://github.com/scummvm/scummvm/commit/5fd376d0201267d72925f1eabc286682eb085497
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-10-29T17:56:47+01:00

Commit Message:
BASE: Auto-detect option now uses the specified path

Changed paths:
    base/commandLine.cpp



diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 474a085..0c3d5d1 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -68,7 +68,7 @@ static const char HELP_STRING[] =
 	"  -z, --list-games         Display list of supported games and exit\n"
 	"  -t, --list-targets       Display list of configured targets and exit\n"
 	"  --list-saves=TARGET      Display a list of saved games for the game (TARGET) specified\n"
-	"  --auto-detect            Display a list of games from current directory\n"
+	"  --auto-detect            Display a list of games from current or specified directory\n"
 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
 	"  --console                Enable the console window (default:enabled)\n"
 #endif
@@ -775,11 +775,12 @@ static void listAudioDevices() {
 	}
 }
 
-/** Display all games in current directory */
-static void autoDetect() {
-
+/** Display all games in the given directory, or current directory if empty */
+static void autoDetect(Common::String path) {
+	if (path.empty())
+		path = ".";
 	//Current directory
-	Common::FSNode dir(".");
+	Common::FSNode dir(path);
 
 	Common::FSList files;
 
@@ -788,7 +789,7 @@ static void autoDetect() {
 
 	GameList candidates(EngineMan.detectGames(files));
 	if (candidates.empty()) {
-		printf("%s\n","ScummVM could not find any game in the current directory" );
+		printf("ScummVM could not find any game in %s\n", path.c_str());
 	} else {
 		printf("ID                   Description\n");
 		printf("-------------------- ---------------------------------------------------------\n");
@@ -1024,7 +1025,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 		printf(HELP_STRING, s_appName);
 		return true;
 	} else if (command == "auto-detect") {
-		autoDetect();
+		autoDetect(settings["path"]);
 		return true;
 	}
 #ifdef DETECTOR_TESTING_HACK


Commit: 23d3d08a9128be11ca7ce134c4832453e7f89845
    https://github.com/scummvm/scummvm/commit/23d3d08a9128be11ca7ce134c4832453e7f89845
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-10-29T17:56:47+01:00

Commit Message:
README: Adding auto-detect command line option

Changed paths:
    README



diff --git a/README b/README
index 327060e..da6d291 100644
--- a/README
+++ b/README
@@ -1309,6 +1309,7 @@ arguments -- see the next section.
   -z, --list-games         Display list of supported games and exit
   -t, --list-targets       Display list of configured targets and exit
   --list-saves=TARGET      Display a list of saved games for the game (TARGET) specified
+  --auto-detect            Display a list of games from current or specified directory
   --console                Enable the console window (default: enabled) (Windows only)
 
   -c, --config=CONFIG      Use alternate configuration file





More information about the Scummvm-git-logs mailing list