summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2019-10-31 12:49:56 +0200
committerKatja Marttila <katja.marttila@qt.io>2019-11-01 07:55:15 +0000
commit03166d8e496c0aa81b5b9b790d90ab07968e56cc (patch)
tree5d0645c6332fd3c12e69de821788fe9660fd69c9
parent1cb9feb9a20df8954e7e281d053e13d81f5c46ee (diff)
Enable QInstaller::setDefaultFilePermissions() also on Windows
In some cases, for example in CreateLocalRepository files may be left with legacy read-only flag on Windows. Even though the permission entries in its Access Control List are sane, this will block all writing operations to the file. Enable setDefaultFilePermissions() on Windows as this will unset the read-only flag if it is set. This still does not affect ACLs. Task-number: QTIFW-1464 Change-Id: I95399e7cb83cb136ef1c978a05f79b6a6790b7e4 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r--src/libs/installer/fileutils.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp
index b000247e6..b11768494 100644
--- a/src/libs/installer/fileutils.cpp
+++ b/src/libs/installer/fileutils.cpp
@@ -306,12 +306,11 @@ bool QInstaller::setDefaultFilePermissions(const QString &fileName, DefaultFileP
/*!
Sets permissions of file or directory specified by \a file to \c 644 or \c 755
based by the value of \a permissions. This is effective only on Unix platforms
- as \c setPermissions() does not manipulate ACLs. On Windows this does nothing
- and always returns \c true.
+ as \c setPermissions() does not manipulate ACLs. On Windows NTFS volumes this
+ only unsets the legacy read-only flag regardless of the value of \a permissions.
*/
bool QInstaller::setDefaultFilePermissions(QFile *file, DefaultFilePermissions permissions)
{
-#ifdef Q_OS_UNIX
if (!file->exists()) {
qWarning() << "Target" << file->fileName() << "does not exists.";
return false;
@@ -325,9 +324,6 @@ bool QInstaller::setDefaultFilePermissions(QFile *file, DefaultFilePermissions p
return false;
}
return true;
-#else
- return true;
-#endif
}
void QInstaller::copyDirectoryContents(const QString &sourceDir, const QString &targetDir)