1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08: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:
smallketchup82 2024-07-04 17:30:42 -04:00
parent fae8f5f81b
commit cae3607caf
No known key found for this signature in database
GPG Key ID: 7345B7C561243F1E
4 changed files with 8 additions and 13 deletions

View File

@ -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();
}
}

View File

@ -31,7 +31,8 @@ namespace osu.Game.Tournament.Screens.Setup
Action = () =>
{
game.RestartApp();
game.RestartAppWhenExited();
game.AttemptExit();
};
folderButton.Action = () => storage.PresentExternally();

View File

@ -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)
{

View File

@ -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
{