aboutsummaryrefslogtreecommitdiff
path: root/libraries/systeminfo
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-09-04 22:10:57 +0200
committerPetr Mrázek <peterix@gmail.com>2021-09-04 22:10:57 +0200
commitc17b359d0380ff7d541b42b2dcc07aa5cd8f2bc4 (patch)
treea38810dee5eed467173ce14350bba57eb7b51a0b /libraries/systeminfo
parent938f896bfa7775cf7dcf1ee6883572f514f53993 (diff)
downloadPrismLauncher-c17b359d0380ff7d541b42b2dcc07aa5cd8f2bc4.tar.gz
PrismLauncher-c17b359d0380ff7d541b42b2dcc07aa5cd8f2bc4.tar.bz2
PrismLauncher-c17b359d0380ff7d541b42b2dcc07aa5cd8f2bc4.zip
GH-4014 fix kernel version scanning on macOS and linux
Diffstat (limited to 'libraries/systeminfo')
-rw-r--r--libraries/systeminfo/src/sys_apple.cpp9
-rw-r--r--libraries/systeminfo/src/sys_unix.cpp9
2 files changed, 16 insertions, 2 deletions
diff --git a/libraries/systeminfo/src/sys_apple.cpp b/libraries/systeminfo/src/sys_apple.cpp
index 2d7d6083..7fc0017b 100644
--- a/libraries/systeminfo/src/sys_apple.cpp
+++ b/libraries/systeminfo/src/sys_apple.cpp
@@ -4,6 +4,7 @@
#include <QString>
#include <QStringList>
+#include <QDebug>
Sys::KernelInfo Sys::getKernelInfo()
{
@@ -23,11 +24,17 @@ Sys::KernelInfo Sys::getKernelInfo()
auto sections = release.split('-');
if(sections.size() >= 1) {
auto versionParts = sections[0].split('.');
- if(sections.size() >= 3) {
+ if(versionParts.size() >= 3) {
out.kernelMajor = sections[0].toInt();
out.kernelMinor = sections[1].toInt();
out.kernelPatch = sections[2].toInt();
}
+ else {
+ qWarning() << "Not enough version numbers in " << sections[0] << " found " << versionParts.size();
+ }
+ }
+ else {
+ qWarning() << "Not enough '-' sections in " << release << " found " << sections.size();
}
return out;
}
diff --git a/libraries/systeminfo/src/sys_unix.cpp b/libraries/systeminfo/src/sys_unix.cpp
index 303ead1f..cba52cfb 100644
--- a/libraries/systeminfo/src/sys_unix.cpp
+++ b/libraries/systeminfo/src/sys_unix.cpp
@@ -8,6 +8,7 @@
#include <QString>
#include <QStringList>
+#include <QDebug>
Sys::KernelInfo Sys::getKernelInfo()
{
@@ -28,11 +29,17 @@ Sys::KernelInfo Sys::getKernelInfo()
auto sections = release.split('-');
if(sections.size() >= 1) {
auto versionParts = sections[0].split('.');
- if(sections.size() >= 3) {
+ if(versionParts.size() >= 3) {
out.kernelMajor = sections[0].toInt();
out.kernelMinor = sections[1].toInt();
out.kernelPatch = sections[2].toInt();
}
+ else {
+ qWarning() << "Not enough version numbers in " << sections[0] << " found " << versionParts.size();
+ }
+ }
+ else {
+ qWarning() << "Not enough '-' sections in " << release << " found " << sections.size();
}
return out;
}