summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src/DlgUpdate.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2016-04-15 14:09:00 +0000
committerKirill Volinsky <mataes2007@gmail.com>2016-04-15 14:09:00 +0000
commit9f78220f472a29bd96414b79fd368d0ad0de062d (patch)
treeec6ee7f5f7d8dca89d97b8e2857d4dcfbc3c45a7 /plugins/PluginUpdater/src/DlgUpdate.cpp
parent18f7e9261c885e953f220ba6836e8bca43a6fc88 (diff)
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
Diffstat (limited to 'plugins/PluginUpdater/src/DlgUpdate.cpp')
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp18
1 files changed, 15 insertions, 3 deletions
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