MINGW-packages/mingw-w64-qt-installer-framework/0003-add-recursive-option-to-rmdir-operation.patch
مهدي شينون (Mehdi Chinoune) c6b29aab50 qt-installer-framework: update to 4.8.0
2024-05-16 18:05:49 +01:00

41 lines
1.6 KiB
Diff

From bdc7e03f69f4a48f0d34340c60d5ccfa20917e62 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 7 May 2014 17:09:33 +0100
Subject: [PATCH 3/9] add recursive option to rmdir operation
---
src/libs/kdtools/updateoperations.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libs/kdtools/updateoperations.cpp b/src/libs/kdtools/updateoperations.cpp
index aeeaffe..4df8c49 100644
--- a/src/libs/kdtools/updateoperations.cpp
+++ b/src/libs/kdtools/updateoperations.cpp
@@ -580,7 +580,9 @@ void RmdirOperation::backup()
{
// Requires only one parameter. That is the name of the file to remove.
// Optionally UNDOOPERATION can be added as well
- if (!checkArgumentCount(1, 3, QLatin1String("<file to remove> [UNDOOPERATION, \"\"]")))
+ // A second optional parameter of true indicates recursive deletion.
+ if (!checkArgumentCount(1, 3, QLatin1String("<file to remove> [UNDOOPERATION, \"\"]")) &&
+ !checkArgumentCount(2, 4, QLatin1String("<file to remove> [UNDOOPERATION, \"\"]")))
return false;
const QString firstArg = arguments().at(0);
@@ -592,8 +595,11 @@ bool RmdirOperation::performOperation()
return false;
}
+ bool isRecursive = (arguments().count() == 2 && arguments().last() == QLatin1String("true")) ? true : false;
+
errno = 0;
- const bool removed = dir.rmdir(firstArg);
+ const bool removed = isRecursive ? dir.removeRecursively()
+ : dir.rmdir(firstArg);
setValue(QLatin1String("removed"), removed);
if (!removed) {
setError(UserDefinedError);
--
2.7.0