更改判断文件存在方式

This commit is contained in:
yangjiaxuan 2022-07-13 19:53:37 +08:00
parent 039d7f0e8a
commit 96cfb0f9b9
2 changed files with 2 additions and 9 deletions

View File

@ -2,7 +2,6 @@
#include "ui_dialog_updateprogress.h" #include "ui_dialog_updateprogress.h"
#include "base/HGUtility.h" #include "base/HGUtility.h"
#include "base/HGMd5.h" #include "base/HGMd5.h"
#include <sys/stat.h>
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
@ -72,7 +71,8 @@ void Dialog_updateProgress::ThreadFunc(HGThread thread, HGPointer param)
QString md5 = QCryptographicHash::hash(fileMsg , QCryptographicHash::Md5).toHex(); QString md5 = QCryptographicHash::hash(fileMsg , QCryptographicHash::Md5).toHex();
bool ret = true; bool ret = true;
if(!p->isFileExists(cfgPath) || md5 != p->m_md5) QFile f(cfgPath);
if(!f.exists() || md5 != p->m_md5)
{ {
typedef HGResult (HGAPI *Func)(HGVersionMgr, const HGChar *, const HGChar *, HGHttpDownloadFunc, HGPointer); typedef HGResult (HGAPI *Func)(HGVersionMgr, const HGChar *, const HGChar *, HGHttpDownloadFunc, HGPointer);
Func func = NULL; Func func = NULL;
@ -130,12 +130,6 @@ void Dialog_updateProgress::on_pushButton_clicked()
close(); close();
} }
bool Dialog_updateProgress::isFileExists(const std::string &filepath)
{
struct stat buffer;
return (stat(filepath.c_str(), &buffer) == 0);
}
void Dialog_updateProgress::closeEvent(QCloseEvent* e) void Dialog_updateProgress::closeEvent(QCloseEvent* e)
{ {
(void)e; (void)e;

View File

@ -32,7 +32,6 @@ private slots:
void on_finish(); void on_finish();
void on_pushButton_clicked(); void on_pushButton_clicked();
bool isFileExists(const std::string& filepath);
protected: protected:
virtual void closeEvent(QCloseEvent* e); virtual void closeEvent(QCloseEvent* e);