aboutsummaryrefslogtreecommitdiff
path: root/base/commandLine.cpp
diff options
context:
space:
mode:
authorThierry Crozat2016-10-29 17:49:58 +0100
committerThierry Crozat2016-10-29 17:56:47 +0100
commit5fd376d0201267d72925f1eabc286682eb085497 (patch)
tree36e4909e5985c5123229abd85b72fbb9a2c052ee /base/commandLine.cpp
parentd65f2b38213c0dd3f60f3c3ab1290d111ad8efb3 (diff)
downloadscummvm-rg350-5fd376d0201267d72925f1eabc286682eb085497.tar.gz
scummvm-rg350-5fd376d0201267d72925f1eabc286682eb085497.tar.bz2
scummvm-rg350-5fd376d0201267d72925f1eabc286682eb085497.zip
BASE: Auto-detect option now uses the specified path
Diffstat (limited to 'base/commandLine.cpp')
-rw-r--r--base/commandLine.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 474a085f66..0c3d5d1610 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