summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();