From 9605b9e05204882e1c6ac62fcf29fffe457331aa Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Wed, 30 Jul 2014 16:43:12 +0000 Subject: Do not unzip icon from plugin's archive when icon component is unchecked git-svn-id: http://svn.miranda-ng.org/main/trunk@9996 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Common.h | 2 +- plugins/PluginUpdater/src/DlgListNew.cpp | 2 +- plugins/PluginUpdater/src/DlgUpdate.cpp | 4 ++-- plugins/PluginUpdater/src/Utils.cpp | 2 +- plugins/PluginUpdater/src/unzipfile.cpp | 9 ++++++--- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'plugins/PluginUpdater/src') diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index a56212c9e9..6c52978a0f 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgMsgPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); int ImageList_AddIconFromIconLib(HIMAGELIST hIml, const char *name); -bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath); +bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch); void strdel(TCHAR *parBuffer, int len); /////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 5f181cbce4..4b669ba160 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -70,7 +70,7 @@ static void ApplyDownloads(void *param) if (DownloadFile(&todo[i].File, nlc)) { ListView_SetItemText(hwndList, i, 2, TranslateT("Succeeded.")); - if (unzip(todo[i].File.tszDiskPath, tszMirandaPath, tszFileBack)) + if (unzip(todo[i].File.tszDiskPath, tszMirandaPath, tszFileBack,true)) SafeDeleteFile(todo[i].File.tszDiskPath); // remove .zip after successful update } else diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 3a9c6129bf..748d33890f 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -115,7 +115,7 @@ static void ApplyUpdates(void *param) BackupFile(tszSrcPath, tszBackFile); } - if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack)) + if ( unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack,true)) SafeDeleteFile(p.File.tszDiskPath); // remove .zip after successful update } } @@ -425,7 +425,7 @@ static void DlgUpdateSilent(void *lParam) } // remove .zip after successful update - if (unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack)) + if (unzip(p.File.tszDiskPath, tszMirandaPath, tszFileBack, true)) SafeDeleteFile(p.File.tszDiskPath); } } diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index a74c878f35..db6f432e29 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -206,7 +206,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT& baseUrl, SERVLIST& arHashes) return false; } - if(!unzip(pFileUrl.tszDiskPath, tszTempPath, NULL)) + if(!unzip(pFileUrl.tszDiskPath, tszTempPath, NULL,true)) return false; DeleteFile(pFileUrl.tszDiskPath); diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 24da1147a4..c0d0592e07 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -45,7 +45,7 @@ void BackupFile(TCHAR *ptszSrcFileName, TCHAR *ptszBackFileName) SafeMoveFile(ptszSrcFileName, ptszBackFileName); } -bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath) +bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath, bool ch) { unz_file_info64 file_info; char filename[MAX_PATH], buf[8192]; @@ -56,6 +56,9 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath) for (char *p = strchr(filename, '/'); p; p = strchr(p+1, '/')) *p = '\\'; + + if (ch && !db_get_b(NULL, MODNAME "Files", StrToLower(ptrA(mir_strdup(filename))), 1)) + return true; TCHAR tszDestFile[MAX_PATH], tszBackFile[MAX_PATH]; TCHAR *ptszNewName = mir_utf8decodeT(filename); @@ -118,7 +121,7 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath) return true; } -bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath) +bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch) { bool bResult = true; @@ -128,7 +131,7 @@ bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath) unzFile uf = unzOpen2_64(ptszZipFile, &ffunc); if (uf) { do { - if (!extractCurrentFile(uf, ptszDestPath, ptszBackPath)) + if (!extractCurrentFile(uf, ptszDestPath, ptszBackPath,ch)) bResult = false; } while (unzGoToNextFile(uf) == UNZ_OK); -- cgit v1.2.3