From 62e1d18e9c380760ae90c757a6187cd4d3b87960 Mon Sep 17 00:00:00 2001 From: Teemu Jokitulppo Date: Fri, 13 Jun 2025 08:23:31 +0300 Subject: Improve lock acquisition error message for better clarity 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 --- src/libs/kdtools/lockfile_unix.cpp | 6 ++++-- src/libs/kdtools/lockfile_win.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3