summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-04-16 16:54:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-04-16 16:54:21 +0300
commitd12310676d262c0d635eb90d4a62a418ce6a506c (patch)
treea55959739e5c0ab79771d251238025fd913d9d09 /plugins/PluginUpdater
parent86e467dcc11f7f5accd6f123e8bfbaf4ef5d1208 (diff)
also we shall remove garbage from the root folder after changing platform
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp3
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp25
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
3 files changed, 20 insertions, 10 deletions
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index 81b793e43e..cde00d9eb2 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -88,6 +88,9 @@ int CMPlugin::Load()
m_impl.m_timer.Start(60 * 1000);
InitTimer(0);
+ // just to be sure that no garbage remained after restart
+ DeleteFileW(InvertMirandaPlatform());
+
g_plugin.setByte(DB_SETTING_NEED_RESTART, 0);
uint32_t dwLen = GetTempPath(_countof(g_wszTempPath), g_wszTempPath);
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index b39f3c7acf..298c46c0f9 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -324,17 +324,22 @@ char* StrToLower(char *str)
/////////////////////////////////////////////////////////////////////////////////////////
+MFilePath InvertMirandaPlatform()
+{
+ MFilePath wszPath;
+ #ifdef _WIN64
+ wszPath.Format(L"%s\\miranda32.exe", g_mirandaPath.get());
+ #else
+ wszPath.Format(L"%s\\miranda64.exe", g_mirandaPath.get());
+ #endif
+ return wszPath;
+}
+
void DoRestart()
{
BOOL bRestartCurrentProfile = g_plugin.getBool("RestartCurrentProfile", true);
- if (g_plugin.bChangePlatform) {
- MFilePath mirstartpath;
-#ifdef _WIN64
- mirstartpath.Format(L"%s\\miranda32.exe", g_mirandaPath.get());
-#else
- mirstartpath.Format(L"%s\\miranda64.exe", g_mirandaPath.get());
-#endif
- CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile, (LPARAM)mirstartpath.c_str());
- }
- else CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile);
+ if (g_plugin.bChangePlatform)
+ CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile, (LPARAM)InvertMirandaPlatform().c_str());
+ else
+ CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile);
}
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 9aaeef3415..b7085723f8 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -268,3 +268,5 @@ void RemoveBackupFolders(void);
void RollbackChanges(TFileName &pwszBackupFolder);
char* StrToLower(char *str);
+
+MFilePath InvertMirandaPlatform();