]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/testdir.cpp
Exit the deleted directory when it is removed
[dolphin.git] / src / tests / testdir.cpp
index c05752171e7dd3b836d1ab3f771b22f327c15278..6fbc4c426aa69df2c1dbf2420820aece02ae1315 100644 (file)
@@ -36,7 +36,7 @@ static void setTimeStamp(const QString& path, const QDateTime& mtime)
     utime(QFile::encodeName(path), &utbuf);
 #elif defined(Q_OS_WIN)
     struct _utimbuf utbuf;
-    utbuf.actime = mtime.toTime_t();
+    utbuf.actime = mtime.toSecsSinceEpoch();
     utbuf.modtime = utbuf.actime;
     _wutime(reinterpret_cast<const wchar_t *>(path.utf16()), &utbuf);
 #endif
@@ -96,6 +96,17 @@ void TestDir::removeFile(const QString& path)
     QFile::remove(absolutePath);
 }
 
+void TestDir::removeDir(const QString& path)
+{
+    QString absolutePath = path;
+    QFileInfo fileInfo(absolutePath);
+    if (!fileInfo.isAbsolute()) {
+        absolutePath = TestDir::path() + QLatin1Char('/') + path;
+    }
+    QDir dirToRemove = QDir(absolutePath);
+    dirToRemove.removeRecursively();
+}
+
 void TestDir::makePathAbsoluteAndCreateParents(QString& path)
 {
     QFileInfo fileInfo(path);