mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 01:57:51 +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:
parent
fae8f5f81b
commit
cae3607caf
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
@ -104,23 +103,17 @@ namespace osu.Desktop
|
|||||||
return new VeloUpdateManager();
|
return new VeloUpdateManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool RestartApp()
|
public override bool RestartAppWhenExited()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var startInfo = new ProcessStartInfo
|
Velopack.UpdateExe.Start(null, true);
|
||||||
{
|
|
||||||
FileName = Process.GetCurrentProcess().MainModule!.FileName,
|
|
||||||
UseShellExecute = true
|
|
||||||
};
|
|
||||||
Process.Start(startInfo);
|
|
||||||
base.AttemptExit();
|
|
||||||
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.RestartApp();
|
return base.RestartAppWhenExited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ namespace osu.Game.Tournament.Screens.Setup
|
|||||||
|
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
game.RestartApp();
|
game.RestartAppWhenExited();
|
||||||
|
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 RestartApp() => false;
|
public virtual bool RestartAppWhenExited() => false;
|
||||||
|
|
||||||
public bool Migrate(string path)
|
public bool Migrate(string path)
|
||||||
{
|
{
|
||||||
|
@ -67,8 +67,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
|
if (r.NewValue == RendererType.Automatic && automaticRendererInUse)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (game?.RestartApp() == true)
|
if (game?.RestartAppWhenExited() == true)
|
||||||
{
|
{
|
||||||
|
game.AttemptExit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user