mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 06:42:54 +08:00
rewrite the restart function
This commit is contained in:
parent
0ee89183cc
commit
1025e5b3cc
@ -105,18 +105,23 @@ namespace osu.Desktop
|
|||||||
return new VeloUpdateManager();
|
return new VeloUpdateManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool RestartAppWhenExited()
|
public override bool RestartApp()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(Process.GetCurrentProcess().MainModule?.FileName ?? throw new InvalidOperationException());
|
var startInfo = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = Process.GetCurrentProcess().MainModule!.FileName,
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
Process.Start(startInfo);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.Error(e, "Failed to restart application");
|
Logger.Error(e, "Failed to restart application");
|
||||||
return base.RestartAppWhenExited();
|
return base.RestartApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
|||||||
|
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
game.RestartAppWhenExited();
|
game.RestartApp();
|
||||||
game.AttemptExit();
|
|
||||||
};
|
};
|
||||||
folderButton.Action = () => storage.PresentExternally();
|
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.
|
/// If supported by the platform, the game will automatically restart after the next exit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Whether a restart operation was queued.</returns>
|
/// <returns>Whether a restart operation was queued.</returns>
|
||||||
public virtual bool RestartAppWhenExited() => false;
|
public virtual bool RestartApp() => false;
|
||||||
|
|
||||||
public bool Migrate(string path)
|
public bool Migrate(string path)
|
||||||
{
|
{
|
||||||
|
@ -67,9 +67,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
|
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (game?.RestartAppWhenExited() == true)
|
if (game?.RestartApp() == true)
|
||||||
{
|
{
|
||||||
game.AttemptExit();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user