diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-07 16:15:18 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-12-20 13:42:51 +0200 |
commit | 48200db8b0e493602ce23f04255dde970cd7a7d5 (patch) | |
tree | c5661becfb0d80359c3eb54e641448c928cb8bb1 /src/sdk | |
parent | 347fc142d29d734223a2afd0d7290256117aefc4 (diff) |
Fix selecting target directory when elevated server process is active
There is a disparency in the return value of QFileInfo::isFile() on
Windows whether QFileInfo uses QFileSystemEngine directly (for local
files, returns false) or with another file engine (QFSFileEngine in this
case, returns true), when the file does not exist on disk.
Installer registers its own file engine handler that handles file
engine creation. It creates custom RemoteFileEngine instances suitable
for writing into more restrictive locations when the connection to the
elevated installer server process is active.
When calling RemoteFileEngine::fileFlags() with TypesMask parameter, the
returned combination of enum values includes FileFlag::FileType when
the given file does not exist, this can be reproduced with both the
active remote server connection that forwards the file engine calls to
the server process, and when the composed QFSFileEngine object is used
directly without the remote connection.
Fix by adding a check if the given target directory path exists, if it
doesn't we can assume it is a directory to be created by the installer.
Also rename function to better match what it does.
Task-number: QTIFW-2383
Change-Id: I906b0676802d9d94e70abeb2dea1f71866cbbec8
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/sdk')
-rw-r--r-- | src/sdk/commandlineinterface.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sdk/commandlineinterface.cpp b/src/sdk/commandlineinterface.cpp index 6b674364c..63deaf4d9 100644 --- a/src/sdk/commandlineinterface.cpp +++ b/src/sdk/commandlineinterface.cpp @@ -267,7 +267,7 @@ bool CommandLineInterface::setTargetDir() targetDir = m_core->value(QInstaller::scTargetDir); qCDebug(QInstaller::lcInstallerInstallLog) << "No target directory specified, using default value:" << targetDir; } - if (m_core->checkTargetDir(targetDir)) { + if (m_core->installationAllowedToDirectory(targetDir)) { QString targetDirWarning = m_core->targetDirWarning(targetDir); if (!targetDirWarning.isEmpty()) { qCWarning(QInstaller::lcInstallerInstallLog) << m_core->targetDirWarning(targetDir); |