From 4bd344a0fb52c422903580925233edcc21216135 Mon Sep 17 00:00:00 2001 From: T1ti <40864460+T1ti@users.noreply.github.com> Date: Sun, 8 Jun 2025 23:25:17 +0200 Subject: [PATCH] warning message for applciation path with special characters --- src/noggit/application/NoggitApplication.cpp | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/noggit/application/NoggitApplication.cpp b/src/noggit/application/NoggitApplication.cpp index 53222463..39d0ba31 100755 --- a/src/noggit/application/NoggitApplication.cpp +++ b/src/noggit/application/NoggitApplication.cpp @@ -64,6 +64,29 @@ namespace Noggit::Application auto applicationCurrentPath = std::filesystem::current_path(); Log << "Noggit Relative Path: " << applicationCurrentPath << std::endl; + auto wpath = applicationCurrentPath.wstring(); + bool hasOnlyAscii = std::all_of(wpath.begin(), wpath.end(), [](wchar_t c) + { + return c <= 127; + }); + + if (!hasOnlyAscii) + { + LogError << "Error : Application execution path contains special characters."; + { + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Critical); + msgBox.setWindowTitle("Application Path Error"); + msgBox.setText("Application execution path contains special characters, noggit only supports standard english characters, move Noggit to a valid path." + "\nThe application will now close."); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + + QCoreApplication::exit(EXIT_FAILURE); + return false; + } + } + //Locate application configuration file auto nogginConfigurationPath = applicationCurrentPath / "noggit.json";