summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakevfs.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:30:57 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:35:24 +0100
commitad16478a76815f8f61d454bf7760aaf9ffbb4b51 (patch)
treeeefdd9219cc9d59b62e042f49fc7555b980cb7a4 /qmake/library/qmakevfs.cpp
parent80a741f3616290897ba0d9f1cbd3c9c5ee62da37 (diff)
parent09c92863001790a0304a5ef389901ee2b5b6cdc2 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
Diffstat (limited to 'qmake/library/qmakevfs.cpp')
-rw-r--r--qmake/library/qmakevfs.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/qmake/library/qmakevfs.cpp b/qmake/library/qmakevfs.cpp
index 613e4e90d7..d23d1f06ff 100644
--- a/qmake/library/qmakevfs.cpp
+++ b/qmake/library/qmakevfs.cpp
@@ -52,8 +52,8 @@ QMakeVfs::QMakeVfs()
{
}
-bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, const QString &contents,
- QString *errStr)
+bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, bool exe,
+ const QString &contents, QString *errStr)
{
#ifndef PROEVALUATOR_FULL
# ifdef PROEVALUATOR_THREAD_SAFE
@@ -75,8 +75,16 @@ bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, const QStr
QByteArray bytes = contents.toLocal8Bit();
QFile cfile(fn);
if (!(mode & QIODevice::Append) && cfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- if (cfile.readAll() == bytes)
+ if (cfile.readAll() == bytes) {
+ if (exe) {
+ cfile.setPermissions(cfile.permissions()
+ | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther);
+ } else {
+ cfile.setPermissions(cfile.permissions()
+ & ~(QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther));
+ }
return true;
+ }
cfile.close();
}
if (!cfile.open(mode | QIODevice::WriteOnly | QIODevice::Text)) {
@@ -89,6 +97,9 @@ bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, const QStr
*errStr = cfile.errorString();
return false;
}
+ if (exe)
+ cfile.setPermissions(cfile.permissions()
+ | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther);
return true;
#endif
}