From a406ce6d557a79a32b3d8b7f6c60971806cd06a5 Mon Sep 17 00:00:00 2001 From: vandalo Date: Tue, 15 Mar 2016 23:09:42 +0100 Subject: COMMON: Fix wrong error message The error message was not correct. When you add a game data dir to launcher and after do this rename game data dir the error was wrong. It said that the "path wasn't a directory", the expected error message was "Path does not exists" because we had changed. How to solve this: We split in two the validation of the path, first we check if it's a existing path and then if the path is a directory. if (!dir.exists()) err = Common::kPathDoesNotExist; else if (!dir.isDirectory()) err = Common::kPathNotDirectory; Solve Bug: 6765 Wrong error code if directory missing --- base/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/main.cpp b/base/main.cpp index ff441df49c..96e2765e27 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -148,8 +148,11 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const #endif // Verify that the game path refers to an actual directory - if (!(dir.exists() && dir.isDirectory())) + if (!dir.exists()) { + err = Common::kPathDoesNotExist; + } else if (!dir.isDirectory()) { err = Common::kPathNotDirectory; + } // Create the game engine if (err.getCode() == Common::kNoError) { -- cgit v1.2.3