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

4
.gitignore vendored
View File

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

View File

@ -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

View File

@ -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")) {

View File

@ -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 = "";

View File

@ -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();