更改判断文件存在方式
This commit is contained in:
parent
039d7f0e8a
commit
96cfb0f9b9
|
@ -2,7 +2,6 @@
|
|||
#include "ui_dialog_updateprogress.h"
|
||||
#include "base/HGUtility.h"
|
||||
#include "base/HGMd5.h"
|
||||
#include <sys/stat.h>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
@ -72,7 +71,8 @@ void Dialog_updateProgress::ThreadFunc(HGThread thread, HGPointer param)
|
|||
QString md5 = QCryptographicHash::hash(fileMsg , QCryptographicHash::Md5).toHex();
|
||||
|
||||
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);
|
||||
Func func = NULL;
|
||||
|
@ -130,12 +130,6 @@ void Dialog_updateProgress::on_pushButton_clicked()
|
|||
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)e;
|
||||
|
|
|
@ -32,7 +32,6 @@ private slots:
|
|||
void on_finish();
|
||||
|
||||
void on_pushButton_clicked();
|
||||
bool isFileExists(const std::string& filepath);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* e);
|
||||
|
||||
|
|
Loading…
Reference in New Issue