app更新升级包下载目录更改到临时目录,定期删除日志文件
This commit is contained in:
parent
db5b8bef02
commit
423d8dc7fc
|
@ -83,14 +83,17 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
m_versionDll = new VersionDll;
|
||||
HGBase_RegisterCrashFunc(CrashFunc, this);
|
||||
|
||||
// HGChar logFilePath[512];
|
||||
// HGBase_GetLogFilePath(logFilePath, 512);
|
||||
// deleteFile(QString::fromStdString(getStdString(logFilePath)));
|
||||
HGChar logFilePath[512];
|
||||
HGBase_GetLogFilePath(logFilePath, 512);
|
||||
deleteFile(QString::fromStdString(getStdString(logFilePath)));
|
||||
|
||||
// HGChar cfgFilePath[512];
|
||||
// HGBase_GetConfigPath(cfgFilePath, 512);
|
||||
// deleteFile(QString::fromStdString(getStdString(cfgFilePath)));
|
||||
HGChar cfgFilePath[512];
|
||||
HGBase_GetConfigPath(cfgFilePath, 512);
|
||||
deleteFile(QString::fromStdString(getStdString(cfgFilePath)));
|
||||
|
||||
HGChar upgradeDpkgPath[512];
|
||||
HGBase_GetTmpPath(upgradeDpkgPath, 512);
|
||||
deleteFile(QString::fromStdString(getStdString(upgradeDpkgPath)));
|
||||
|
||||
#if defined(OEM_HANWANG)
|
||||
this->setWindowIcon(QIcon(":images/image_rsc/logo/Hanvon_logo1.ico"));
|
||||
|
@ -3944,39 +3947,42 @@ QString MainWindow::getLogInfo(HGResult ret)
|
|||
return str;
|
||||
}
|
||||
|
||||
//void MainWindow::deleteFile(QString filePath)
|
||||
//{
|
||||
// QDir dir(filePath);
|
||||
// if(!dir.exists())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// dir.setFilter(QDir::Files | QDir::NoSymLinks);
|
||||
// QFileInfoList list = dir.entryInfoList();
|
||||
void MainWindow::deleteFile(QString filePath)
|
||||
{
|
||||
QDir dir(filePath);
|
||||
if(!dir.exists())
|
||||
{
|
||||
return;
|
||||
}
|
||||
dir.setFilter(QDir::Files | QDir::NoSymLinks);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
|
||||
// int count = list.count();
|
||||
// if(count <= 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
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(QString::compare(suffix, QString("exe"), Qt::CaseInsensitive) == 0)
|
||||
// {
|
||||
// QDateTime nowTime = QDateTime::currentDateTime();
|
||||
// QDateTime createTime = info.created();
|
||||
// int days = createTime.daysTo(nowTime);
|
||||
// if (days > 14)
|
||||
// {
|
||||
// HGBase_DeleteFile(info.absoluteFilePath().c_str());
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
for(int i=0; i < count; i++)
|
||||
{
|
||||
QFileInfo info = list.at(i);
|
||||
QString suffix = info.suffix();
|
||||
if(suffix == "log")
|
||||
{
|
||||
QDateTime nowTime = QDateTime::currentDateTime();
|
||||
QDateTime createTime = info.created();
|
||||
int days = createTime.daysTo(nowTime);
|
||||
if (days > 14)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -4081,7 +4087,7 @@ void MainWindow::on_actionact_update_triggered()
|
|||
HGBase_GetFileSuffix(url.toStdString().c_str(), suffix, 64);
|
||||
|
||||
HGChar savePath[512];
|
||||
HGBase_GetConfigPath(savePath, 512);
|
||||
HGBase_GetTmpPath(savePath, 512);
|
||||
HGBase_CreateDir(savePath);
|
||||
|
||||
HGChar fileName[128];
|
||||
|
|
|
@ -265,7 +265,7 @@ private:
|
|||
bool isLimitAccessFolder(QString filePath);
|
||||
static QString GetDevType(const QString& fwVersion);
|
||||
void upgradeFwAndLockDevice();
|
||||
// void deleteFile(QString filePath);
|
||||
void deleteFile(QString filePath);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
Loading…
Reference in New Issue