summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Jokitulppo <[email protected]>2025-06-13 08:23:31 +0300
committerTeemu Jokitulppo <[email protected]>2025-07-07 09:27:56 +0300
commit62e1d18e9c380760ae90c757a6187cd4d3b87960 (patch)
tree671548fbd89a7d9110823c394270c7d24db767cc
parenta3685db1a5a4b1efe64d2caf6f101dff7129cfec (diff)
Improve lock acquisition error message for better clarityHEADdev
Updated the error string shown when the installer fails to acquire a lock file (e.g., when another installer instance is running). This applies to both Unix and Windows implementations. Task-number: QTIFW-3459 Change-Id: If807d152334ca6401827c5408158419d19bce779 Reviewed-by: Katja Marttila <[email protected]>
-rw-r--r--src/libs/kdtools/lockfile_unix.cpp6
-rw-r--r--src/libs/kdtools/lockfile_win.cpp7
2 files changed, 9 insertions, 4 deletions
diff --git a/src/libs/kdtools/lockfile_unix.cpp b/src/libs/kdtools/lockfile_unix.cpp
index bb978c40f..58c1a5784 100644
--- a/src/libs/kdtools/lockfile_unix.cpp
+++ b/src/libs/kdtools/lockfile_unix.cpp
@@ -67,8 +67,10 @@ bool LockFile::Private::lock()
errno = 0;
locked = flock(handle, LOCK_NB | LOCK_EX) != -1;
if (!locked) {
- errorString = QCoreApplication::translate("LockFile", "Cannot obtain the lock for "
- "file \"%1\": %2").arg(QDir::toNativeSeparators(filename), QString::fromLocal8Bit(strerror(errno)));
+ errorString = QCoreApplication::translate("LockFile", "Cannot obtain the lock for \"%1\": %2.\n"
+ "This likely means another instance of the installer is already running.\n"
+ "Please close any other installer sessions and try again.")
+ .arg(QDir::toNativeSeparators(filename), QString::fromLocal8Bit(strerror(errno)));
}
return locked;
}
diff --git a/src/libs/kdtools/lockfile_win.cpp b/src/libs/kdtools/lockfile_win.cpp
index 7fc808d39..e97f15e91 100644
--- a/src/libs/kdtools/lockfile_win.cpp
+++ b/src/libs/kdtools/lockfile_win.cpp
@@ -64,8 +64,11 @@ bool LockFile::Private::lock()
FlushFileBuffers(handle);
if (!::LockFile(handle, 0, 0, QFileInfo(filename).size(), 0)) {
- errorString = QCoreApplication::translate("LockFile", "Cannot obtain the lock for "
- "file \"%1\": %2").arg(QDir::toNativeSeparators(filename), QInstaller::windowsErrorString(GetLastError()));
+ errorString = QCoreApplication::translate("LockFile",
+ "Cannot obtain the lock for \"%1\": %2.\n"
+ "This likely means another instance of the installer is already running.\n"
+ "Please close any other installer sessions and try again.")
+ .arg(QDir::toNativeSeparators(filename), QInstaller::windowsErrorString(GetLastError()));
} else {
locked = true;
}