diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-08 13:58:34 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-08 13:58:34 +0000 |
commit | 7098878c15e41955369620fe2844a133aef4b4ef (patch) | |
tree | 7ad1532663e5905971b94c70367025205c31e1ab /plugins/PluginUpdater | |
parent | 6bd1e383879d3c7f6528088bb6fb721c44d64b79 (diff) |
remove successfully unpacked zip files
git-svn-id: http://svn.miranda-ng.org/main/trunk@1402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/src/Common.h | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Notifications.cpp | 3 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 11 |
3 files changed, 11 insertions, 5 deletions
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;
}
|