aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2024-04-19 14:04:26 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2024-04-22 14:50:08 +0300
commitc5b453ae1ca051838e302c5d192ae951a2eeabf6 (patch)
treece93ed4795192d253df2ff051ba17c9b19918179
parent092c155d034f84ff29b0ba8035da921d07eac02f (diff)
CIP: clean up installations.ini on LicenseClient::serviceAvailable()
The CIP API has a function to deduce the precense of the service installation. For this it checks the presence of the installations.ini file, if present then it implies that the Service exists on the system. But the installations.ini may be left in inconsistent state. The Service itself already cleans up this file upon start, but this is too late for the CIP API. The file is also cleaned up by the Qt Online Installer when uninstalling the license-service component. Make the CIP API to purge the installations.ini as well, before trying to deduce the Service installation on the system. Task-number: QLS-908 Pick-to: 3.0 Change-Id: I05d76e543310eb773c6eb140351299efbe745f39 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/libs/qlicenseclient/licenseclient.cpp3
-rw-r--r--src/libs/qlicenseclient/licenseclient_p.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libs/qlicenseclient/licenseclient.cpp b/src/libs/qlicenseclient/licenseclient.cpp
index 317d52d..8e12e4a 100644
--- a/src/libs/qlicenseclient/licenseclient.cpp
+++ b/src/libs/qlicenseclient/licenseclient.cpp
@@ -16,6 +16,9 @@ namespace QLicenseClient {
*/
/*
+ Parses the installations.ini file for suitable service installation. Invalid
+ sections are removed from the file.
+
Returns \c true if a license service installation matching the client
library version was found, or the service is already running, indicated
by a valid TCP port.
diff --git a/src/libs/qlicenseclient/licenseclient_p.cpp b/src/libs/qlicenseclient/licenseclient_p.cpp
index cf9732f..5913d9a 100644
--- a/src/libs/qlicenseclient/licenseclient_p.cpp
+++ b/src/libs/qlicenseclient/licenseclient_p.cpp
@@ -59,6 +59,11 @@ static std::string portFilePath()
bool LicenseClientPrivate::serviceAvailable()
{
+ const std::string &config = LicdSetup::getQtAppDataLocation()
+ + USER_SETTINGS_FOLDER_NAME + DIR_SEPARATOR + DAEMON_INSTALLATIONS_FILE;
+
+ LicdSetup::purgeInstallationsConfig(config);
+
uint16_t port = 0;
const std::string program = LicdSetup::getMatchingServiceInstallation(DAEMON_VERSION);
if (program.empty()) {