summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-14 09:29:58 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-17 11:06:28 +0000
commit26bcc0565f49c731a4f288f93f04056ca20136a5 (patch)
tree72081d0d8ed73f536a249adca5a92d55be6b982d /tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
parentd6553d2cd8a2bd84520363ee0c2b9c5c803b5543 (diff)
QDir::removeRecursively(): Retry file deletion with write permission set.
On Windows, having read-only files in a directory can cause removal to fail. When file deletion fails, check on the permissions, set write permissions and retry. Split apart code paths by OS in tst_QDir::removeRecursivelyFailure(); deletion of the read-only directory on UNIX should still fail. Change-Id: I36e54be5229a7b552e90fd5f42722b868fa0b6ee Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp')
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index e144e32c77..3e98a369ce 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -215,6 +215,8 @@ void tst_QTemporaryDir::autoRemove()
QFile file(dirName + "/dir1/file");
QVERIFY(file.open(QIODevice::WriteOnly));
QCOMPARE(file.write("Hello"), 5LL);
+ file.close();
+ QVERIFY(file.setPermissions(QFile::ReadUser));
}
#ifdef Q_OS_WIN
QTRY_VERIFY(!QDir(dirName).exists());