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/libs/installer/packagemanagercore.h | |
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/libs/installer/packagemanagercore.h')
-rw-r--r-- | src/libs/installer/packagemanagercore.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h index 6698155c3..6b5a04728 100644 --- a/src/libs/installer/packagemanagercore.h +++ b/src/libs/installer/packagemanagercore.h @@ -216,7 +216,7 @@ public: Q_INVOKABLE QString toNativeSeparators(const QString &path); Q_INVOKABLE QString fromNativeSeparators(const QString &path); - bool checkTargetDir(const QString &targetDirectory); + bool installationAllowedToDirectory(const QString &targetDirectory); QString targetDirWarning(const QString &targetDirectory) const; public: |