From 7098878c15e41955369620fe2844a133aef4b4ef Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Aug 2012 13:58:34 +0000 Subject: remove successfully unpacked zip files git-svn-id: http://svn.miranda-ng.org/main/trunk@1402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Common.h | 2 +- plugins/PluginUpdater/src/Notifications.cpp | 3 ++- plugins/PluginUpdater/src/unzipfile.cpp | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'plugins/PluginUpdater/src') diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index ffe3f9b032..a3a88da424 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -144,4 +144,4 @@ void __stdcall RestartMe(void*); BOOL AllowUpdateOnStartup(); VOID InitTimer(); -void unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath); +bool unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath); diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp index 0ef119ee9c..8d0a2937c2 100644 --- a/plugins/PluginUpdater/src/Notifications.cpp +++ b/plugins/PluginUpdater/src/Notifications.cpp @@ -280,7 +280,8 @@ static void ApplyUpdates(void* param) continue; FILEINFO& p = todo[i]; - unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack); + if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack)) + DeleteFile(p.File.tszDiskPath); } DestroyWindow(hDlg); diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index dc55dfca43..6d3057d12d 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -91,17 +91,22 @@ bool extractCurrentFile(unzFile uf, TCHAR* ptszDestPath, TCHAR* ptszBackPath) return true; } -void unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath) +bool unzip(const TCHAR* ptszZipFile, TCHAR* ptszDestPath, TCHAR* ptszBackPath) { + bool bResult = true; + zlib_filefunc64_def ffunc; fill_fopen64_filefunc(&ffunc); - + unzFile uf = unzOpen2_64(ptszZipFile, &ffunc); if (uf) { do { - extractCurrentFile(uf, ptszDestPath, ptszBackPath); + if ( !extractCurrentFile(uf, ptszDestPath, ptszBackPath)) + bResult = false; } while (unzGoToNextFile(uf) == UNZ_OK); unzClose(uf); } + + return bResult; } -- cgit v1.2.3