安装包放至配置文件目录,启动app则删除

This commit is contained in:
yangjiaxuan 2022-11-29 15:42:18 +08:00
parent 423d8dc7fc
commit f1b01282b6
3 changed files with 31 additions and 12 deletions

View File

@ -85,15 +85,11 @@ MainWindow::MainWindow(QWidget *parent)
HGChar logFilePath[512];
HGBase_GetLogFilePath(logFilePath, 512);
deleteFile(QString::fromStdString(getStdString(logFilePath)));
deleteOverdueLogFile(QString::fromStdString(getStdString(logFilePath)));
HGChar cfgFilePath[512];
HGBase_GetConfigPath(cfgFilePath, 512);
deleteFile(QString::fromStdString(getStdString(cfgFilePath)));
HGChar upgradeDpkgPath[512];
HGBase_GetTmpPath(upgradeDpkgPath, 512);
deleteFile(QString::fromStdString(getStdString(upgradeDpkgPath)));
deleteUpgradePkg(QString::fromStdString(getStdString(cfgFilePath)));
#if defined(OEM_HANWANG)
this->setWindowIcon(QIcon(":images/image_rsc/logo/Hanvon_logo1.ico"));
@ -3947,9 +3943,9 @@ QString MainWindow::getLogInfo(HGResult ret)
return str;
}
void MainWindow::deleteFile(QString filePath)
void MainWindow::deleteOverdueLogFile(const QString& logFilePath)
{
QDir dir(filePath);
QDir dir(logFilePath);
if(!dir.exists())
{
return;
@ -3977,7 +3973,30 @@ void MainWindow::deleteFile(QString filePath)
HGBase_DeleteFile(info.absoluteFilePath().toStdString().c_str());
}
}
else if(suffix == "exe")
}
}
void MainWindow::deleteUpgradePkg(const QString &cfgFilePath)
{
QDir dir(cfgFilePath);
if(!dir.exists())
{
return;
}
dir.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();
int count = list.count();
if(count <= 0)
{
return;
}
for(int i=0; i < count; i++)
{
QFileInfo info = list.at(i);
QString suffix = info.suffix();
if(suffix == "exe")
{
HGBase_DeleteFile(info.absoluteFilePath().toStdString().c_str());
}
@ -4087,7 +4106,7 @@ void MainWindow::on_actionact_update_triggered()
HGBase_GetFileSuffix(url.toStdString().c_str(), suffix, 64);
HGChar savePath[512];
HGBase_GetTmpPath(savePath, 512);
HGBase_GetConfigPath(savePath, 512);
HGBase_CreateDir(savePath);
HGChar fileName[128];

View File

@ -265,7 +265,8 @@ private:
bool isLimitAccessFolder(QString filePath);
static QString GetDevType(const QString& fwVersion);
void upgradeFwAndLockDevice();
void deleteFile(QString filePath);
void deleteOverdueLogFile(const QString& logFilePath);
void deleteUpgradePkg(const QString& cfgFilePath);
private:
Ui::MainWindow *ui;

View File

@ -236,7 +236,6 @@ HEADERS += \
../../../app/scanner/widget_statusbar.h \
../../../app/scanner/dialog_admin.h \
../../../app/scanner/dialog_log.h \
../../../app/scanner/config.h \
../../../app/scanner/cfg/gb_json.h \
../../../app/scanner/cfg/cJSON.h \
../../../app/scanner/HGImgThumb.h \