diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-07-10 10:55:15 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-07-10 11:11:28 +0200 |
commit | a7d5e67556bd32496ce0a0f98a5ee225e00977e0 (patch) | |
tree | 2d03934a8ebd91060963513461a54732d06e053c | |
parent | 3b102b026b6fdd8dfbc284741d8df7c1d6dcc9d3 (diff) | |
download | qttools-a7d5e67556bd32496ce0a0f98a5ee225e00977e0.tar.gz |
windeployqt: Clear read-only attribute when copying files.
The deletion of the empty QML directories fails when not doing so.
Task-number: QTBUG-40152
Change-Id: I0ff78440646239897b4867c3b3cfe1af8b2769f9
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r-- | src/windeployqt/utils.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/windeployqt/utils.h b/src/windeployqt/utils.h index f184b514e..9665beabc 100644 --- a/src/windeployqt/utils.h +++ b/src/windeployqt/utils.h @@ -337,13 +337,23 @@ bool updateFile(const QString &sourceFileName, QFile file(sourceFileName); if (optVerboseLevel) std::wcout << "Updating " << sourceFileInfo.fileName() << ".\n"; - if (!(flags & SkipUpdateFile) && !file.copy(targetFileName)) { - *errorMessage = QString::fromLatin1("Cannot copy %1 to %2: %3") + if (!(flags & SkipUpdateFile)) { + if (!file.copy(targetFileName)) { + *errorMessage = QString::fromLatin1("Cannot copy %1 to %2: %3") .arg(QDir::toNativeSeparators(sourceFileName), QDir::toNativeSeparators(targetFileName), file.errorString()); - return false; - } + return false; + } + if (!(file.permissions() & QFile::WriteUser)) { // QTBUG-40152, clear inherited read-only attribute + QFile targetFile(targetFileName); + if (!targetFile.setPermissions(targetFile.permissions() | QFile::WriteUser)) { + *errorMessage = QString::fromLatin1("Cannot set write permission on %1: %2") + .arg(QDir::toNativeSeparators(targetFileName), file.errorString()); + return false; + } + } // Check permissions + } // !SkipUpdateFile if (json) json->addFile(sourceFileName, targetDirectory); return true; |