mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
Fix up restarting
Earlier I changed the restarting logic to not wait until the program exits and instead try to facilitate restarting alone. This did not work, and it became clear we'd need Velopack to do the restarting. This reverts back and supposedly brings restarting logic in line with how Velopack does it
This commit is contained in:
parent
fae8f5f81b
commit
cae3607caf
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Versioning;
|
||||
@ -104,23 +103,17 @@ namespace osu.Desktop
|
||||
return new VeloUpdateManager();
|
||||
}
|
||||
|
||||
public override bool RestartApp()
|
||||
public override bool RestartAppWhenExited()
|
||||
{
|
||||
try
|
||||
{
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = Process.GetCurrentProcess().MainModule!.FileName,
|
||||
UseShellExecute = true
|
||||
};
|
||||
Process.Start(startInfo);
|
||||
base.AttemptExit();
|
||||
Velopack.UpdateExe.Start(null, true);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Failed to restart application");
|
||||
return base.RestartApp();
|
||||
return base.RestartAppWhenExited();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,8 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
|
||||
Action = () =>
|
||||
{
|
||||
game.RestartApp();
|
||||
game.RestartAppWhenExited();
|
||||
game.AttemptExit();
|
||||
};
|
||||
folderButton.Action = () => storage.PresentExternally();
|
||||
|
||||
|
@ -513,7 +513,7 @@ namespace osu.Game
|
||||
/// If supported by the platform, the game will automatically restart after the next exit.
|
||||
/// </summary>
|
||||
/// <returns>Whether a restart operation was queued.</returns>
|
||||
public virtual bool RestartApp() => false;
|
||||
public virtual bool RestartAppWhenExited() => false;
|
||||
|
||||
public bool Migrate(string path)
|
||||
{
|
||||
|
@ -67,8 +67,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
|
||||
return;
|
||||
|
||||
if (game?.RestartApp() == true)
|
||||
if (game?.RestartAppWhenExited() == true)
|
||||
{
|
||||
game.AttemptExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user