diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-01 11:23:45 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-01 11:23:45 +0000 |
commit | aa3a5cfcadf962743fa4ffc41a33da03651aea84 (patch) | |
tree | 1b6d3f7ecbf075397bc905faf1f6eb9ae2267635 | |
parent | 0f84c762b6cfcc5571d4c9b9c97726fc6cb4ad2c (diff) |
%platform% macro recognition for PluginUpdater
git-svn-id: http://svn.miranda-ng.org/main/trunk@1740 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/PluginUpdater/src/Common.h | 6 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Scanner.cpp | 25 |
2 files changed, 16 insertions, 15 deletions
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<TCHAR> 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);
|