PropagateLocalRemove: Make it possible to remove read only files (#4277)
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 21 Dec 2015 12:25:10 +0000 (13:25 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 21 Dec 2015 12:25:10 +0000 (13:25 +0100)
src/libsync/propagatorjobs.cpp

index 404f6238b1715efd145cc50fa0e38c747862fa05..e17ab60175219110f6ad69b665c6a481ee79b05d 100644 (file)
@@ -66,6 +66,12 @@ bool PropagateLocalRemove::removeRecursively(const QString& path)
         if (isDir) {
             ok = removeRecursively(path + QLatin1Char('/') + di.fileName()); // recursive
         } else {
+#ifdef Q_OS_WIN
+            // On Windows, write only files cannot be deleted. (#4277)
+            if (!di.fileInfo().isWritable()) {
+                FileSystem::setFileReadOnlyWeak(di.filePath(),false);
+            }
+#endif
             QFile f(di.filePath());
             ok = f.remove();
             if (!ok) {