app更新升级包下载目录更改到临时目录,定期删除日志文件

This commit is contained in:
yangjiaxuan 2022-11-29 14:00:50 +08:00
parent db5b8bef02
commit 423d8dc7fc
2 changed files with 45 additions and 39 deletions

View File

@ -83,14 +83,17 @@ MainWindow::MainWindow(QWidget *parent)
m_versionDll = new VersionDll; m_versionDll = new VersionDll;
HGBase_RegisterCrashFunc(CrashFunc, this); HGBase_RegisterCrashFunc(CrashFunc, this);
// HGChar logFilePath[512]; HGChar logFilePath[512];
// HGBase_GetLogFilePath(logFilePath, 512); HGBase_GetLogFilePath(logFilePath, 512);
// deleteFile(QString::fromStdString(getStdString(logFilePath))); deleteFile(QString::fromStdString(getStdString(logFilePath)));
// HGChar cfgFilePath[512]; HGChar cfgFilePath[512];
// HGBase_GetConfigPath(cfgFilePath, 512); HGBase_GetConfigPath(cfgFilePath, 512);
// deleteFile(QString::fromStdString(getStdString(cfgFilePath))); deleteFile(QString::fromStdString(getStdString(cfgFilePath)));
HGChar upgradeDpkgPath[512];
HGBase_GetTmpPath(upgradeDpkgPath, 512);
deleteFile(QString::fromStdString(getStdString(upgradeDpkgPath)));
#if defined(OEM_HANWANG) #if defined(OEM_HANWANG)
this->setWindowIcon(QIcon(":images/image_rsc/logo/Hanvon_logo1.ico")); this->setWindowIcon(QIcon(":images/image_rsc/logo/Hanvon_logo1.ico"));
@ -3944,39 +3947,42 @@ QString MainWindow::getLogInfo(HGResult ret)
return str; return str;
} }
//void MainWindow::deleteFile(QString filePath) void MainWindow::deleteFile(QString filePath)
//{ {
// QDir dir(filePath); QDir dir(filePath);
// if(!dir.exists()) if(!dir.exists())
// { {
// return; return;
// } }
// dir.setFilter(QDir::Files | QDir::NoSymLinks); dir.setFilter(QDir::Files | QDir::NoSymLinks);
// QFileInfoList list = dir.entryInfoList(); QFileInfoList list = dir.entryInfoList();
// int count = list.count(); int count = list.count();
// if(count <= 0) if(count <= 0)
// { {
// return; return;
// } }
// for(int i=0; i < count; i++) for(int i=0; i < count; i++)
// { {
// QFileInfo info = list.at(i); QFileInfo info = list.at(i);
// QString suffix = info.suffix(); QString suffix = info.suffix();
// if(QString::compare(suffix, QString("exe"), Qt::CaseInsensitive) == 0) if(suffix == "log")
// { {
// QDateTime nowTime = QDateTime::currentDateTime(); QDateTime nowTime = QDateTime::currentDateTime();
// QDateTime createTime = info.created(); QDateTime createTime = info.created();
// int days = createTime.daysTo(nowTime); int days = createTime.daysTo(nowTime);
// if (days > 14) if (days > 14)
// { {
// HGBase_DeleteFile(info.absoluteFilePath().c_str()); HGBase_DeleteFile(info.absoluteFilePath().toStdString().c_str());
// } }
// } }
else if(suffix == "exe")
// } {
//} HGBase_DeleteFile(info.absoluteFilePath().toStdString().c_str());
}
}
}
void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now) void MainWindow::on_scanOptions_changed(const QString &device, const QString &option, bool checked_now)
{ {
@ -4081,7 +4087,7 @@ void MainWindow::on_actionact_update_triggered()
HGBase_GetFileSuffix(url.toStdString().c_str(), suffix, 64); HGBase_GetFileSuffix(url.toStdString().c_str(), suffix, 64);
HGChar savePath[512]; HGChar savePath[512];
HGBase_GetConfigPath(savePath, 512); HGBase_GetTmpPath(savePath, 512);
HGBase_CreateDir(savePath); HGBase_CreateDir(savePath);
HGChar fileName[128]; HGChar fileName[128];

View File

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