From aa3a5cfcadf962743fa4ffc41a33da03651aea84 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 1 Oct 2012 11:23:45 +0000 Subject: %platform% macro recognition for PluginUpdater git-svn-id: http://svn.miranda-ng.org/main/trunk@1740 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/Common.h | 6 +----- plugins/PluginUpdater/src/Scanner.cpp | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'plugins/PluginUpdater') diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 066e03c17b..110e32234d 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -97,11 +97,7 @@ struct PlugOptions #define DEFAULT_PERIOD 1 #define DEFAULT_PERIODMEASURE 1 -#ifdef WIN64 - #define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x64" -#else - #define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x32" -#endif +#define DEFAULT_UPDATE_URL "http://miranda-ng.org/distr/stable/x%platform%" #define IDINFO 3 #define IDDOWNLOAD 4 diff --git a/plugins/PluginUpdater/src/Scanner.cpp b/plugins/PluginUpdater/src/Scanner.cpp index 204017da22..43ac20dff2 100644 --- a/plugins/PluginUpdater/src/Scanner.cpp +++ b/plugins/PluginUpdater/src/Scanner.cpp @@ -204,22 +204,27 @@ static void CheckUpdates(void *) DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL)); DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar); } - else { - #ifdef WIN64 - if (_tcsstr(dbVar.ptszVal, _T("x32"))) { - DBWriteContactSettingTString(NULL, MODNAME, "UpdateURL", _T(DEFAULT_UPDATE_URL)); - DBGetContactSettingTString(NULL, MODNAME, "UpdateURL", &dbVar); - } - #endif - } - TCHAR *tszBaseUrl = NEWTSTR_ALLOCA(dbVar.ptszVal); + + REPLACEVARSARRAY vars[2]; + vars[0].lptzKey = _T("platform"); + #ifdef WIN64 + vars[0].lptzValue = _T("64"); + #else + vars[0].lptzValue = _T("32"); + #endif + vars[1].lptzKey = vars[1].lptzValue = 0; + + REPLACEVARSDATA dat = { sizeof(REPLACEVARSDATA) }; + dat.dwFlags = RVF_TCHAR; + dat.variables = vars; + mir_ptr tszBaseUrl((TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)dbVar.ptszVal, (LPARAM)&dat)); DBFreeVariant(&dbVar); // Download version info ShowPopup(NULL, TranslateT("Plugin Updater"), TranslateT("Downloading version info..."), 4, 0); FILEURL pFileUrl; - mir_sntprintf(pFileUrl.tszDownloadURL, SIZEOF(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), tszBaseUrl); + mir_sntprintf(pFileUrl.tszDownloadURL, SIZEOF(pFileUrl.tszDownloadURL), _T("%s/hashes.zip"), (TCHAR*)tszBaseUrl); mir_sntprintf(pFileUrl.tszDiskPath, SIZEOF(pFileUrl.tszDiskPath), _T("%s\\hashes.zip"), tszRoot); if (!DownloadFile(pFileUrl.tszDownloadURL, pFileUrl.tszDiskPath)) { ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("An error occured while downloading the update."), 1, 0); -- cgit v1.2.3