Skip to content

Commit

Permalink
Follow-up to #5203, related to #5174: GameSetupDialog needs to handle…
Browse files Browse the repository at this point in the history
… exceptions due to foreign characters in the filenames.
  • Loading branch information
codereader committed Apr 7, 2020
1 parent 624bc16 commit cb56f95
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion radiant/ui/prefdialog/GameSetupPageTdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <regex>
#include "i18n.h"
#include "imodule.h"
#include "itextstream.h"
#include "igame.h"

#include "wxutil/dialog/MessageBox.h"
Expand All @@ -16,6 +17,7 @@
#include <wx/panel.h>

#include "string/trim.h"
#include "string/encoding.h"
#include "os/file.h"
#include "os/path.h"
#include "os/dir.h"
Expand Down Expand Up @@ -219,7 +221,16 @@ void GameSetupPageTdm::validateSettings()

os::foreachItemInDirectory(_config.enginePath, [&](const fs::path& path)
{
found |= std::regex_match(path.filename().string(), exeRegex);
try
{
found |= std::regex_match(path.filename().string(), exeRegex);
}
catch (const std::system_error& ex)
{
rWarning() << "[vfs] Skipping file " << string::to_utf8(path.filename().wstring()) <<
" - possibly unsupported characters in filename? " <<
"(Exception: " << ex.what() << ")" << std::endl;
}
});

if (!found)
Expand Down

0 comments on commit cb56f95

Please sign in to comment.