From c7fb09d2e8b91f74052f51e442cc8921ed8b3ec6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 May 2013 17:47:19 +0000 Subject: PluginUpdater now updates also language packs git-svn-id: http://svn.miranda-ng.org/main/trunk@4783 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Scanner.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'plugins/PluginUpdater/src/Scanner.cpp') diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index f013d0dfe4..eebd69cd62 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -145,6 +145,18 @@ static bool CheckFileRename(const TCHAR *ptszOldName, TCHAR *pNewName) typedef OBJLIST SERVLIST; +static bool isValidExtension(const TCHAR *ptszFileName) +{ + const TCHAR *pExt = _tcsrchr(ptszFileName, '.'); + if (pExt == NULL) + return false; + + if ( !_tcsicmp(pExt, _T(".dll"))) return true; + if ( !_tcsicmp(pExt, _T(".exe"))) return true; + if ( !_tcsicmp(pExt, _T(".txt"))) return true; + return false; +} + static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const TCHAR *tszBaseUrl, SERVLIST& hashes, OBJLIST *UpdateFiles) { // skip updater's own folder @@ -174,9 +186,7 @@ static void ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, cons continue; } - TCHAR *pExt = _tcsrchr(ffd.cFileName, '.'); - if (pExt == NULL) continue; - if ( _tcsicmp(pExt, _T(".dll")) && _tcsicmp(pExt, _T(".exe"))) + if ( !isValidExtension(ffd.cFileName)) continue; // calculate the current file's relative name and store it into tszNewName -- cgit v1.2.3