Skip to content

Commit ba1ada7

Browse files
committed
Continue to restart app as administrator if app is run as administrator already
1 parent ca6f077 commit ba1ada7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,18 @@ public async void RestartApp()
8585
// Wait for all image caches to be saved before restarting
8686
await ImageLoader.WaitSaveAsync();
8787

88-
// Restart requires Squirrel's Update.exe to be present in the parent folder,
89-
// it is only published from the project's release pipeline. When debugging without it,
90-
// the project may not restart or just terminates. This is expected.
91-
UpdateManager.RestartApp(Constant.ApplicationFileName);
88+
// If app is run as administrator already, we continue to restart app as administrator
89+
if (Win32Helper.IsAdministrator())
90+
{
91+
App.RestartAppAsAdministrator();
92+
}
93+
else
94+
{
95+
// Restart requires Squirrel's Update.exe to be present in the parent folder,
96+
// it is only published from the project's release pipeline. When debugging without it,
97+
// the project may not restart or just terminates. This is expected.
98+
UpdateManager.RestartApp(Constant.ApplicationFileName);
99+
}
92100
}
93101

94102
public void ShowMainWindow() => _mainVM.Show();

0 commit comments

Comments
 (0)