From 97ecd2b560357a1c7756d7b93d0b820f63071080 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 6 Aug 2012 20:52:37 +0000 Subject: fix for the repetitive update git-svn-id: http://svn.miranda-ng.org/main/trunk@1388 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Scanner.cpp | 8 ++++---- plugins/PluginUpdater/src/unzipfile.cpp | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index 20cc98ea40..e8cb5c2f99 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -38,9 +38,9 @@ typedef pair hashItem; static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& hashes, vector* UpdateFiles) { - TCHAR tszMask[MAX_PATH], tszFileBack[MAX_PATH]; + TCHAR tszMask[MAX_PATH], tszFileTemp[MAX_PATH]; mir_sntprintf(tszMask, SIZEOF(tszMask), _T("%s\\*"), tszFolder); - mir_sntprintf(tszFileBack, SIZEOF(tszFileBack), _T("%s\\Temp"), tszRoot); + mir_sntprintf(tszFileTemp, SIZEOF(tszFileTemp), _T("%s\\Temp"), tszRoot); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(tszMask, &ffd); @@ -91,7 +91,7 @@ static void ScanFolder(const TCHAR* tszFolder, const TCHAR* tszBaseUrl, hashMap& mir_sntprintf(FileInfo.File.tszDownloadURL, SIZEOF(FileInfo.File.tszDownloadURL), _T("%s/%s.zip"), tszBaseUrl, ffd.cFileName); _tcslwr(FileInfo.File.tszDownloadURL); - mir_sntprintf(FileInfo.File.tszDiskPath, SIZEOF(FileInfo.File.tszDiskPath), _T("%s\\%s.zip"), tszFileBack, ffd.cFileName); + mir_sntprintf(FileInfo.File.tszDiskPath, SIZEOF(FileInfo.File.tszDiskPath), _T("%s\\%s.zip"), tszFileTemp, ffd.cFileName); UpdateFiles->push_back(FileInfo); } // end compare versions @@ -108,7 +108,7 @@ static void __stdcall LaunchDialog(void* param) static void CheckUpdates(void *) { - TCHAR tszBuff[2048] = {0}, /*tszFileInfo[30] = {0},*/ tszTmpIni[MAX_PATH] = {0}; + TCHAR tszBuff[2048] = {0}, tszTmpIni[MAX_PATH] = {0}; char szKey[64] = {0}; DBVARIANT dbVar = {0}; diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index fcafc5b17c..dc55dfca43 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -59,6 +59,7 @@ bool extractCurrentFile(unzFile uf, TCHAR* ptszDestPath, TCHAR* ptszBackPath) if (err != UNZ_OK) return false; + DeleteFile(tszBackFile); MoveFile(tszDestFile, tszBackFile); HANDLE hFile = CreateFile(tszDestFile, GENERIC_WRITE, FILE_SHARE_WRITE, 0, -- cgit v1.2.3