Log visual c++ redist version

This commit is contained in:
T1ti
2024-07-17 04:47:35 +02:00
parent 60e5ebcb2c
commit 595f36311f

View File

@@ -64,7 +64,7 @@ namespace Noggit::Application
if (!std::filesystem::exists(noggitProjectPath)) if (!std::filesystem::exists(noggitProjectPath))
{ {
std::filesystem::create_directory(noggitProjectPath); std::filesystem::create_directory(noggitProjectPath);
Log << "Noggit Project Folder Not Loaded! Creating..." << std::endl; // Log << "Noggit Project Folder Not Loaded! Creating..." << std::endl;
} }
auto listFilePath = applicationConfiguration.ApplicationListFilePath; auto listFilePath = applicationConfiguration.ApplicationListFilePath;
@@ -78,11 +78,43 @@ namespace Noggit::Application
auto databaseDefinitionPath = applicationConfiguration.ApplicationDatabaseDefinitionsPath; auto databaseDefinitionPath = applicationConfiguration.ApplicationDatabaseDefinitionsPath;
if (!std::filesystem::exists(databaseDefinitionPath)) if (!std::filesystem::exists(databaseDefinitionPath))
{ {
// LogError << "Unable to find database definitions! please reinstall Noggit Red, or download from wow.tools" << std::endl; LogError << "Unable to find database definitions! please reinstall Noggit Red, or download from wow.tools" << std::endl;
} }
Log << "Database Definitions found! : " << databaseDefinitionPath << std::endl; Log << "Database Definitions found! : " << databaseDefinitionPath << std::endl;
// Check MSVC redistribuable version
const QString registryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
// Visual C++ 2015 (MSVC++ 14.0)
// Visual C++ 2017 (MSVC++ 14.1)
// Visual C++ 2019 (MSVC++ 14.2)
// Visual C++ 2022 (MSVC++ 14.3)
const QStringList versions = {
"14.0", // MSVC 14.0 Visual Studio 2015
// "15.0", // MSVC 14.1 Visual Studio 2017
// "16.0", // MSVC 14.2 Visual Studio 2019
// "17.0" // MSVC 14.3 Visual Studio 2022
};
bool redist_found = false;
foreach (const QString & version, versions) {
QString keyPath = registryPath + version + "\\VC\\Runtimes\\x64";
QSettings settings(keyPath, QSettings::NativeFormat);
if (settings.contains("Installed")) {
bool installed = settings.value("Installed").toBool();
if (installed) {
redist_found = true;
QString versionNumber = settings.value("Version").toString();
LogDebug << "Found MSVC " << version.toStdString() << " Redistributable Version: " << versionNumber.toStdString() << std::endl;
}
}
}
if (!redist_found)
LogDebug << "No Redistribuable MSVC version found" << std::endl;
// Initialize OpenGL
QSurfaceFormat format; QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL); format.setRenderableType(QSurfaceFormat::OpenGL);