From eca91dcdca76fbde8050629631f06518109f9d02 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Thu, 2 Dec 2021 17:34:27 +0200 Subject: Fix "Empty filename passed to function" warning on target directory page When verifying the selected target directory for forbidden directories (user home and root), we incorrectly checked if the directory was empty regardless of if the path of the QDir object was empty. No need to check this as installing into either of these should be prevented - the folder may be populated after initial installation and installer would then nuke it on uninstallation. Also fix related warning about deprecated '=' operator. Task-number: QTIFW-2424 Change-Id: If4835dcc719e09e0a51a13149ae05d75c0e2b359 Reviewed-by: Katja Marttila --- src/libs/installer/packagemanagercore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libs') diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 311ac544d..9d594b2eb 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -1103,8 +1103,8 @@ QString PackageManagerCore::targetDirWarning(const QString &targetDirectory) con } } - target = target.canonicalPath(); - if (!target.isEmpty() && (target == QDir::root() || target == QDir::home())) { + target.setPath(target.canonicalPath()); + if (!target.path().isEmpty() && (target == QDir::root() || target == QDir::home())) { return tr("As the install directory is completely deleted, installing in %1 is forbidden.") .arg(QDir::toNativeSeparators(target.path())); } -- cgit v1.2.3