42 lines
1.2 KiB
Diff
42 lines
1.2 KiB
Diff
From 45371bb3feb34876ab27ab6420e0d39c870a5e13 Mon Sep 17 00:00:00 2001
|
|
From: peijiankang <peijiankang@kylinos.cn>
|
|
Date: Thu, 25 May 2023 17:13:53 +0800
|
|
Subject: [PATCH] modify version of kylin-scanner is null
|
|
|
|
---
|
|
src/main.cpp | 18 +++++++++++++++++-
|
|
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main.cpp b/src/main.cpp
|
|
index 48ae229..fa6b2a8 100644
|
|
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -140,7 +140,23 @@ static QString getSystemArchitecture()
|
|
|
|
static QString getAppVersion()
|
|
{
|
|
- QString versionResult = execCmd(QString("dpkg-parsechangelog -l %1 --show-field Version").arg(ChangelogFilePath));
|
|
+ QProcess process;
|
|
+ QString versionResult;
|
|
+ QStringList options;
|
|
+ options << "-q" << "kylin-scanner";
|
|
+ process.start("rpm", options);
|
|
+ process.waitForFinished();
|
|
+ QString dpkgInfo = process.readAll();
|
|
+ QStringList infoList = dpkgInfo.split("\n");
|
|
+ for (int n = 0; n < infoList.size(); n++) {
|
|
+ QString strInfoLine = infoList[n];
|
|
+ if (strInfoLine.contains("kylin-scanner")) {
|
|
+ QStringList lineInfoList = strInfoLine.split(QRegExp("-"));
|
|
+ if (lineInfoList.size() >= 3) {
|
|
+ versionResult = lineInfoList[2];
|
|
+ }
|
|
+ }
|
|
+ }
|
|
return versionResult;
|
|
}
|
|
|
|
--
|
|
2.39.1
|
|
|