From 2d7e8f99679cd5e80ad2cda9be0a328d6d708467 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 18 Mar 2022 15:19:02 +0100 Subject: [PATCH] Pass information about the operating system to the version reporter script (#1865) --- ext/ghoul | 2 +- src/engine/openspaceengine.cpp | 9 +++++---- src/util/versionchecker.cpp | 19 ++++++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index e295fd85c5..8d85f42fc3 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e295fd85c5842b66f9f14d76b44b6d48a368746e +Subproject commit 8d85f42fc313c6ef884dfbad96d2248859eb94c2 diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 6a136ec221..f65c2372fc 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -180,6 +180,10 @@ void OpenSpaceEngine::initialize() { LTRACE("OpenSpaceEngine::initialize(begin)"); global::initialize(); + // Initialize the general capabilities component + SysCap.addComponent( + std::make_unique() + ); _printEvents = global::configuration->isPrintingEvents; @@ -403,11 +407,8 @@ void OpenSpaceEngine::initializeGL() { glbinding::Binding::initialize(global::windowDelegate->openGLProcedureAddress); //glbinding::Binding::useCurrentContext(); - LDEBUG("Adding system components"); + LDEBUG("Adding OpenGL capabilities components"); // Detect and log OpenCL and OpenGL versions and available devices - SysCap.addComponent( - std::make_unique() - ); SysCap.addComponent( std::make_unique() ); diff --git a/src/util/versionchecker.cpp b/src/util/versionchecker.cpp index 23b0c21136..6d1af19e41 100644 --- a/src/util/versionchecker.cpp +++ b/src/util/versionchecker.cpp @@ -27,10 +27,12 @@ #include #include #include +#include +#include #include namespace { - constexpr const char* _loggerCat = "VersionChecker"; + constexpr const char _loggerCat[] = "VersionChecker"; } // namespace namespace openspace { @@ -40,9 +42,20 @@ VersionChecker::~VersionChecker() { } void VersionChecker::requestLatestVersion(const std::string& url) { + using GCC = ghoul::systemcapabilities::GeneralCapabilitiesComponent; + std::string operatingSystem = SysCap.component().operatingSystemString(); + + // Need to escape non-http characters when passing the operating system in the url + for (size_t i = 0; i < operatingSystem.size(); i++) { + if (operatingSystem[i] == ' ') { + operatingSystem.erase(i, 1); + operatingSystem.insert(i, "%20"); + } + } + std::string fullUrl = fmt::format( - "{}?client_version={}&commit_hash={}", - url, OPENSPACE_VERSION_NUMBER, OPENSPACE_GIT_COMMIT + "{}?client_version={}&commit_hash={}&operating_system={}", + url, OPENSPACE_VERSION_NUMBER, OPENSPACE_GIT_COMMIT, operatingSystem ); if (_request) {