4
1
mirror of https://github.com/QuasarApp/CQtDeployer.git synced 2025-05-02 12:39:35 +00:00

new clear method

This commit is contained in:
Andrei Yankovich 2018-12-14 21:45:27 +03:00
parent 34c5684c04
commit 4cc3109cb5
5 changed files with 34 additions and 5 deletions

2
.gitignore vendored

@ -56,5 +56,5 @@ sharedQt/
distro/ distro/
staticQt/ staticQt/
staticQtWin64/
build build

@ -7,7 +7,7 @@
QT -= gui QT -= gui
CONFIG += c++11 console CONFIG += c++14 console
CONFIG -= app_bundle CONFIG -= app_bundle
QMAKE_LFLAGS+=" -static-libgcc -static-libstdc++" QMAKE_LFLAGS+=" -static-libgcc -static-libstdc++"
@ -56,6 +56,8 @@ DISTFILES += \
../snap/snapcraft.yaml \ ../snap/snapcraft.yaml \
../README.md \ ../README.md \
../sharedBuild.sh \ ../sharedBuild.sh \
../README.md ../README.md \
../staticBuildWin.sh
win32: LIBS += -lshlwapi win32: LIBS += -lshlwapi

@ -154,6 +154,8 @@ void Deploy::deploy() {
if (!isWinApp && !createRunScript()) { if (!isWinApp && !createRunScript()) {
qCritical() << "run script not created!"; qCritical() << "run script not created!";
} }
settings.setValue("deployedFiles", deployedFiles);
} }
QString Deploy::getQtDir() const { return DeployUtils::qtDir; } 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; 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) { void Deploy::extract(const QString &file, bool isExtractPlugins) {
@ -759,6 +767,17 @@ bool Deploy::extractQml() {
void Deploy::clear() { 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); QDir dir(targetDir);
if (dir.cd("lib")) { if (dir.cd("lib")) {

@ -8,6 +8,7 @@
#ifndef DEPLOY_H #ifndef DEPLOY_H
#define DEPLOY_H #define DEPLOY_H
#include <QDir> #include <QDir>
#include <QSettings>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <windependenciesscanner.h> #include <windependenciesscanner.h>
@ -19,6 +20,9 @@ class Deploy {
bool onlyCLibs = false; bool onlyCLibs = false;
bool isWinApp =false; bool isWinApp =false;
int depchLimit = 0; int depchLimit = 0;
QStringList deployedFiles;
QSettings settings;
QString qmlScaner = ""; QString qmlScaner = "";
QString qmake = ""; QString qmake = "";
QString target = ""; QString target = "";

@ -138,6 +138,10 @@ bool parseQt(Deploy &deploy) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QCoreApplication::setOrganizationName("QuasarApp");
QCoreApplication::setOrganizationDomain("https://github.com/QuasarApp");
QCoreApplication::setApplicationName("CQtDeployer");
if (!QuasarAppUtils::Params::parseParams(argc, argv)) { if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
qWarning() << "wrong parametrs"; qWarning() << "wrong parametrs";
help(); help();