From a2c9c05de2dfabbb2bb614390c8e03023dad2bd1 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Tue, 29 Nov 2022 18:16:59 +0000 Subject: Exit the deleted directory when it is removed If current directory is a local file, try to find nearest dir ancestor and open it. Display warning to the user. --- src/tests/testdir.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/tests/testdir.cpp') diff --git a/src/tests/testdir.cpp b/src/tests/testdir.cpp index 5d75a5343..6fbc4c426 100644 --- a/src/tests/testdir.cpp +++ b/src/tests/testdir.cpp @@ -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); -- cgit v1.3