From 4de0c30ad1bdec5e37a4ebb5c3ea6ca5f07eff09 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 26 Aug 2006 11:33:15 +0000 Subject: Fix bug #1544801 - ITE: Engine creates launcher entry when failing to launch svn-id: r23751 --- engines/saga/game.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/engines/saga/game.cpp b/engines/saga/game.cpp index a1bdda6b57..61af35f93f 100644 --- a/engines/saga/game.cpp +++ b/engines/saga/game.cpp @@ -77,9 +77,29 @@ DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) { } PluginError Engine_SAGA_create(OSystem *syst, Engine **engine) { + assert(syst); assert(engine); - *engine = new Saga::SagaEngine(syst); - return kNoError; + + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + warning("SagaEngine: invalid game path '%s'", dir.path().c_str()); + return kInvalidPathError; + } + + // Invoke the detector + Common::String gameid = ConfMan.get("gameid"); + DetectedGameList detectedGames = Engine_SAGA_detectGames(fslist); + + for (uint i = 0; i < detectedGames.size(); i++) { + if (detectedGames[i].gameid == gameid) { + *engine = new Saga::SagaEngine(syst); + return kNoError; + } + } + + warning("SagaEngine: Unable to locate game data at path '%s'", dir.path().c_str()); + return kNoGameDataFoundError; } REGISTER_PLUGIN(SAGA, "SAGA Engine", "Inherit the Earth (C) Wyrmkeep Entertainment"); -- cgit v1.2.3