warning message for applciation path with special characters

This commit is contained in:
T1ti
2025-06-08 23:25:17 +02:00
parent 3977e60c64
commit 4bd344a0fb

View File

@@ -64,6 +64,29 @@ namespace Noggit::Application
auto applicationCurrentPath = std::filesystem::current_path(); auto applicationCurrentPath = std::filesystem::current_path();
Log << "Noggit Relative Path: " << applicationCurrentPath << std::endl; 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 //Locate application configuration file
auto nogginConfigurationPath = applicationCurrentPath / "noggit.json"; auto nogginConfigurationPath = applicationCurrentPath / "noggit.json";