From bea4f461249bd832b97e32989c89d4ecabec6e60 Mon Sep 17 00:00:00 2001
From: EndrII <endriimail@gmail.com>
Date: Sat, 18 Aug 2018 19:02:07 +0300
Subject: [PATCH] added clear flag

---
 CDQ/deploy.cpp | 15 +++++++++++++++
 CDQ/deploy.h   |  3 +++
 CDQ/main.cpp   |  6 ++++++
 3 files changed, 24 insertions(+)

diff --git a/CDQ/deploy.cpp b/CDQ/deploy.cpp
index ec93438..a707510 100644
--- a/CDQ/deploy.cpp
+++ b/CDQ/deploy.cpp
@@ -309,6 +309,21 @@ bool Deploy::copyFolder( QDir &from,  QDir &to, const QString& filter) {
     return true;
 }
 
+void Deploy::clear() {
+    QDir dir(targetDir);
+
+    if (dir.cd("lib")) {
+        dir.removeRecursively();
+        dir.cdUp();
+    }
+
+    if (dir.cd("plugins")) {
+        dir.removeRecursively();
+        dir.cdUp();
+
+    }
+}
+
 void Deploy::strip(const QString& dir) {
     QProcess P;
 
diff --git a/CDQ/deploy.h b/CDQ/deploy.h
index 5427388..edc307f 100644
--- a/CDQ/deploy.h
+++ b/CDQ/deploy.h
@@ -49,6 +49,9 @@ public:
     void deploy();
     QString getQtDir() const;
     void setQtDir(const QString &value);
+
+    void clear();
+
 };
 
 #endif // DEPLOY_H
diff --git a/CDQ/main.cpp b/CDQ/main.cpp
index 0102752..55504f5 100644
--- a/CDQ/main.cpp
+++ b/CDQ/main.cpp
@@ -22,6 +22,7 @@ void help() {
     qInfo() << "   ignoreCudaLib            : it filter ignore cuda lib of nvidea";
     qInfo() << "   -ignore [list,params]    : ignore filter for libs";
     qInfo() << "                            | for example -ignore libicudata.so.56,libicudata2.so.56";
+    qInfo() << "   clear                    : delete all old deploy data";
 
 }
 
@@ -42,6 +43,11 @@ bool parseQt(Deploy& deploy) {
         return false;
     }
 
+    if (QuasarAppUtils::isEndable("clear")) {
+        qInfo() << "clear old data";
+        deploy.clear();
+    }
+
     if (!deploy.setTarget(bin)) {
         qCritical() << "error init targeet dir";
         return false;