Skip to content

Commit 438203f

Browse files
authored
Use POSIX uname function instead of QSysInfo for BSD Unix
For GhostBSD we have OS "unknown" for Report. https://vulkan.gpuinfo.org/displayreport.php?id=11527 We should use POSIX uname function instead of QSysInfo for BSD Unix After fixing we have correct result: https://vulkan.gpuinfo.org/displayreport.php?id=11577 Also, see #124
1 parent 3468d60 commit 438203f

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

vulkancapsviewer.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
#include <windows.h>
5353
#endif
5454

55-
#ifdef __linux__
55+
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__linux__)
56+
#define USE_UTSNAME
5657
#include <sys/utsname.h>
5758
#endif
5859

@@ -84,9 +85,17 @@ OSInfo getOperatingSystem()
8485
{
8586
// QSysInfo works for all supported operating systems
8687
OSInfo osInfo = {};
88+
// GhostBSD - QSysInfo::productType().toStdString() returs "unknown"
89+
#ifndef USE_UTSNAME
8790
osInfo.name = QSysInfo::productType().toStdString();
88-
osInfo.architecture = QSysInfo::buildCpuArchitecture().toStdString();
8991
osInfo.version = QSysInfo::productVersion().toStdString();
92+
#else
93+
struct utsname n;
94+
uname(&n);
95+
osInfo.name = n.sysname;
96+
osInfo.version = n.version;
97+
#endif
98+
osInfo.architecture = QSysInfo::buildCpuArchitecture().toStdString();
9099
// The Qt version used does not detect Windows 11, so we use Win32 API to detect it via the build version
91100
#if defined(_WIN32)
92101
HMODULE hModule = LoadLibrary(TEXT("ntdll.dll"));

0 commit comments

Comments
 (0)