From 9f78220f472a29bd96414b79fd368d0ad0de062d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 15 Apr 2016 14:09:00 +0000 Subject: PluginUpdater: added ability to change platform. Note: old miranda*.exe you should delete manually git-svn-id: http://svn.miranda-ng.org/main/trunk@16660 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/PluginUpdater/src/DlgUpdate.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'plugins/PluginUpdater/src/DlgUpdate.cpp') diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 12dcbce55f..ca93241e54 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -131,6 +131,9 @@ static void ApplyUpdates(void *param) opts.bForceRedownload = false; db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD); + opts.bChangePlatform = false; + db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM); + db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5); if (opts.bBackup) @@ -452,6 +455,9 @@ static void DlgUpdateSilent(void *param) opts.bForceRedownload = false; db_unset(NULL, MODNAME, DB_SETTING_REDOWNLOAD); + opts.bChangePlatform = false; + db_unset(NULL, MODNAME, DB_SETTING_CHANGEPLATFORM); + db_set_b(NULL, MODNAME, DB_SETTING_RESTART_COUNT, 5); db_set_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 1); @@ -622,15 +628,21 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, const TCHAR *tsz // calculate the current file's relative name and store it into tszNewName TCHAR tszNewName[MAX_PATH]; if (!CheckFileRename(ffd.cFileName, tszNewName)) { - if (level == 0) - _tcsncpy(tszNewName, ffd.cFileName, MAX_PATH); + if (level == 0) { + if (opts.bChangePlatform) { + if (!mir_tstrcmpi(ffd.cFileName, _T("miranda32.exe"))) + _tcsncpy_s(tszNewName, _T("miranda64.exe"), _TRUNCATE); + if (!mir_tstrcmpi(ffd.cFileName, _T("miranda64.exe"))) + _tcsncpy_s(tszNewName, _T("miranda32.exe"), _TRUNCATE); + } + } else mir_sntprintf(tszNewName, _T("%s\\%s"), tszFolder + cbBaseLen, ffd.cFileName); } TCHAR *ptszUrl; int MyCRC; - mir_sntprintf(tszBuf, _T("%s\\%s"), tszFolder, ffd.cFileName); + mir_sntprintf(tszBuf, _T("%s\\%s"), tszFolder, tszNewName); bool bDeleteOnly = (tszNewName[0] == 0); // this file is not marked for deletion -- cgit v1.2.3