Continue to restart app as administrator if app is run as administrator already

This commit is contained in:
Jack251970 2025-06-03 14:45:12 +08:00
parent ca6f077e63
commit ba1ada7bf1

View file

@ -85,10 +85,18 @@ namespace Flow.Launcher
// Wait for all image caches to be saved before restarting
await ImageLoader.WaitSaveAsync();
// Restart requires Squirrel's Update.exe to be present in the parent folder,
// it is only published from the project's release pipeline. When debugging without it,
// the project may not restart or just terminates. This is expected.
UpdateManager.RestartApp(Constant.ApplicationFileName);
// If app is run as administrator already, we continue to restart app as administrator
if (Win32Helper.IsAdministrator())
{
App.RestartAppAsAdministrator();
}
else
{
// Restart requires Squirrel's Update.exe to be present in the parent folder,
// it is only published from the project's release pipeline. When debugging without it,
// the project may not restart or just terminates. This is expected.
UpdateManager.RestartApp(Constant.ApplicationFileName);
}
}
public void ShowMainWindow() => _mainVM.Show();