Skip to content

Commit

Permalink
Resolve #5203: Let the game setup dialog look for x64 as well as x86 …
Browse files Browse the repository at this point in the history
…engine executables. The string in the darkmod.game file is interpreted as regex to achieve this.
  • Loading branch information
codereader committed Apr 5, 2020
1 parent 3a031e4 commit 0064226
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions install/games/darkmod.game
Expand Up @@ -6,9 +6,9 @@
enginepath_win32="C:/games/darkmod/"
enginepath_linux="/usr/local/games/darkmod/"
enginepath_macos="/usr/local/games/darkmod/"
engine_win32="TheDarkMod.exe"
engine_linux="thedarkmod.x86"
engine_macos="thedarkmod.app"
engine_win32="^TheDarkMod(x64|){1}\.exe$"
engine_linux="^thedarkmod.(x64|x86){1}$"
engine_macos="^thedarkmod.app$"
prefix=""
basegame=""
archivetypes="pk4"
Expand Down
13 changes: 10 additions & 3 deletions radiant/ui/prefdialog/GameSetupPageTdm.cpp
@@ -1,6 +1,7 @@
#include "GameSetupPageTdm.h"

#include <set>
#include <regex>
#include "i18n.h"
#include "imodule.h"
#include "igame.h"
Expand Down Expand Up @@ -213,12 +214,18 @@ void GameSetupPageTdm::validateSettings()
#endif
;

std::string exeName = _game->getKeyValue(ENGINE_EXECUTABLE_ATTRIBUTE);
bool found = false;
std::regex exeRegex(_game->getKeyValue(ENGINE_EXECUTABLE_ATTRIBUTE));

if (!os::fileOrDirExists(darkmodExePath / exeName))
os::foreachItemInDirectory(_config.enginePath, [&](const fs::path& path)
{
found |= std::regex_match(path.filename().string(), exeRegex);
});

if (!found)
{
// engine executable not present
errorMsg += fmt::format(_("The engine executable \"{0}\" could not be found in the specified folder.\n"), exeName);
errorMsg += _("The engine executable(s) could not be found in the specified folder.\n");
}

// Check the mod path (=mission path), if not empty
Expand Down

0 comments on commit 0064226

Please sign in to comment.