diff --git a/.gitignore b/.gitignore index 53673fc..085c884 100644 --- a/.gitignore +++ b/.gitignore @@ -56,5 +56,5 @@ sharedQt/ distro/ staticQt/ - -build \ No newline at end of file +staticQtWin64/ +build diff --git a/CQtDeployer/CQtDeployer.pro b/CQtDeployer/CQtDeployer.pro index b6dafd2..db77489 100644 --- a/CQtDeployer/CQtDeployer.pro +++ b/CQtDeployer/CQtDeployer.pro @@ -7,7 +7,7 @@ QT -= gui -CONFIG += c++11 console +CONFIG += c++14 console CONFIG -= app_bundle QMAKE_LFLAGS+=" -static-libgcc -static-libstdc++" @@ -56,6 +56,8 @@ DISTFILES += \ ../snap/snapcraft.yaml \ ../README.md \ ../sharedBuild.sh \ - ../README.md + ../README.md \ + ../staticBuildWin.sh win32: LIBS += -lshlwapi + diff --git a/CQtDeployer/deploy.cpp b/CQtDeployer/deploy.cpp index 4170e3b..88259b2 100644 --- a/CQtDeployer/deploy.cpp +++ b/CQtDeployer/deploy.cpp @@ -154,6 +154,8 @@ void Deploy::deploy() { if (!isWinApp && !createRunScript()) { qCritical() << "run script not created!"; } + + settings.setValue("deployedFiles", deployedFiles); } QString Deploy::getQtDir() const { return DeployUtils::qtDir; } @@ -235,7 +237,13 @@ bool Deploy::copyFile(const QString &file, const QString &target, qInfo() << "copy :" << target + QDir::separator() + name; - return QFile::copy(file, target + QDir::separator() + name); + if (!QFile::copy(file, target + QDir::separator() + name)) { + return false; + } + + deployedFiles += target + QDir::separator() + name; + + return true; } void Deploy::extract(const QString &file, bool isExtractPlugins) { @@ -759,6 +767,17 @@ bool Deploy::extractQml() { void Deploy::clear() { + qInfo() << "clear start!"; + + deployedFiles = settings.value("deployedFiles", QStringList()).toStringList(); + + for (auto file : deployedFiles) { + if (!QFile::remove(file)) { + qWarning() << file << "remove fail!"; + } + } + deployedFiles.clear(); + QDir dir(targetDir); if (dir.cd("lib")) { diff --git a/CQtDeployer/deploy.h b/CQtDeployer/deploy.h index 2bfc260..2a662b2 100644 --- a/CQtDeployer/deploy.h +++ b/CQtDeployer/deploy.h @@ -8,6 +8,7 @@ #ifndef DEPLOY_H #define DEPLOY_H #include <QDir> +#include <QSettings> #include <QString> #include <QStringList> #include <windependenciesscanner.h> @@ -19,6 +20,9 @@ class Deploy { bool onlyCLibs = false; bool isWinApp =false; int depchLimit = 0; + QStringList deployedFiles; + + QSettings settings; QString qmlScaner = ""; QString qmake = ""; QString target = ""; diff --git a/CQtDeployer/main.cpp b/CQtDeployer/main.cpp index 03ce694..41a3b81 100644 --- a/CQtDeployer/main.cpp +++ b/CQtDeployer/main.cpp @@ -138,6 +138,10 @@ bool parseQt(Deploy &deploy) { } int main(int argc, char *argv[]) { + QCoreApplication::setOrganizationName("QuasarApp"); + QCoreApplication::setOrganizationDomain("https://github.com/QuasarApp"); + QCoreApplication::setApplicationName("CQtDeployer"); + if (!QuasarAppUtils::Params::parseParams(argc, argv)) { qWarning() << "wrong parametrs"; help();