aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorThierry Crozat2017-08-06 19:13:30 +0100
committerThierry Crozat2017-08-06 19:14:13 +0100
commit62957b38ac439718a9b9bd53d475f38bab73833a (patch)
tree462ced5941fc7ad98d9a33ecb66ab158f33f60c9 /base
parent8e5b8510c852335c0cc65441550110a8dcf64d4e (diff)
downloadscummvm-rg350-62957b38ac439718a9b9bd53d475f38bab73833a.tar.gz
scummvm-rg350-62957b38ac439718a9b9bd53d475f38bab73833a.tar.bz2
scummvm-rg350-62957b38ac439718a9b9bd53d475f38bab73833a.zip
CMD: Handle --game=<ID> for --detect and --auto-detect
The README and command line help indicated this should work, but this was not implemented.
Diffstat (limited to 'base')
-rw-r--r--base/commandLine.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 6814abd889..62219b2da7 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -852,16 +852,18 @@ static bool addGameToConf(const GameDescriptor &gd) {
return true;
}
-static GameList recListGames(Common::FSNode dir, bool recursive) {
+static GameList recListGames(Common::FSNode dir, Common::String gameId, bool recursive) {
GameList list = getGameList(dir);
if (recursive) {
Common::FSList files;
dir.getChildren(files, Common::FSNode::kListDirectoriesOnly);
for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
- GameList rec = recListGames(*file, recursive);
- for (GameList::const_iterator game = rec.begin(); game != rec.end(); ++game)
- list.push_back(*game);
+ GameList rec = recListGames(*file, gameId, recursive);
+ for (GameList::const_iterator game = rec.begin(); game != rec.end(); ++game) {
+ if (gameId.empty() || game->gameid().c_str() == gameId)
+ list.push_back(*game);
+ }
}
}
@@ -869,14 +871,14 @@ static GameList recListGames(Common::FSNode dir, bool recursive) {
}
/** Display all games in the given directory, return ID of first detected game */
-static Common::String detectGames(Common::String path, Common::String recursiveOptStr) {
+static Common::String detectGames(Common::String path, Common::String gameId, Common::String recursiveOptStr) {
bool noPath = path.empty();
if (noPath)
path = ".";
bool recursive = (recursiveOptStr == "true");
//Current directory
Common::FSNode dir(path);
- GameList candidates = recListGames(dir, recursive);
+ GameList candidates = recListGames(dir, gameId, recursive);
if (candidates.empty()) {
printf("WARNING: ScummVM could not find any game in %s\n", dir.getPath().c_str());
@@ -1177,14 +1179,14 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
// From an UX point of view, however, it might get confusing.
// Consider removing this if consensus says otherwise.
} else {
- command = detectGames(settings["path"], settings["recursive"]);
+ command = detectGames(settings["path"], settings["game"], settings["recursive"]);
if (command.empty()) {
err = Common::kNoGameDataFoundError;
return true;
}
}
} else if (command == "detect") {
- detectGames(settings["path"], settings["recursive"]);
+ detectGames(settings["path"], settings["game"], settings["recursive"]);
return true;
} else if (command == "add") {
addGames(settings["path"], settings["game"], settings["recursive"]);