AutoUpdater: support optionally restarting Dolphin after update

This commit is contained in:
Pierre Bourdon
2018-03-23 00:29:03 +01:00
parent 773ec975f3
commit 9628333b86
6 changed files with 55 additions and 22 deletions

View File

@ -111,7 +111,8 @@ void AutoUpdateChecker::CheckForUpdate()
OnUpdateAvailable(nvi);
}
void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInformation& info)
void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInformation& info,
AutoUpdateChecker::RestartMode restart_mode)
{
#ifdef _WIN32
std::map<std::string, std::string> updater_flags;
@ -122,6 +123,9 @@ void AutoUpdateChecker::TriggerUpdate(const AutoUpdateChecker::NewVersionInforma
updater_flags["install-base-path"] = File::GetExeDirectory();
updater_flags["log-file"] = File::GetExeDirectory() + DIR_SEP + UPDATER_LOG_FILE;
if (restart_mode == RestartMode::RESTART_AFTER_UPDATE)
updater_flags["binary-to-restart"] = File::GetExePath();
// Copy the updater so it can update itself if needed.
std::string updater_path = File::GetExeDirectory() + DIR_SEP + UPDATER_FILENAME;
std::string reloc_updater_path = File::GetExeDirectory() + DIR_SEP + UPDATER_RELOC_FILENAME;