From f87a5fe4c6819b0f67608fc2c4bdc8af0ded0bcd Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sat, 24 Jan 2026 18:29:21 +0100 Subject: [PATCH] Open download page when launcher cannot be overwritten --- src/openlauncher/MainWindow.axaml.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/openlauncher/MainWindow.axaml.cs b/src/openlauncher/MainWindow.axaml.cs index 29f4ffe..c5e049a 100644 --- a/src/openlauncher/MainWindow.axaml.cs +++ b/src/openlauncher/MainWindow.axaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Threading; @@ -326,6 +327,17 @@ private void ShowError(string caption, string message) errorBox.Message = message; } + private void OpenDownloadPage() + { + const string uri = "https://openrct2.io/download/launcher"; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + System.Diagnostics.Process.Start(uri); + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + System.Diagnostics.Process.Start("open", uri); + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + System.Diagnostics.Process.Start("xdg-open", uri); + } + private async void update_Click(object sender, RoutedEventArgs e) { if (_updateCheckResult == null) @@ -334,7 +346,14 @@ private async void update_Click(object sender, RoutedEventArgs e) var processPath = Environment.ProcessPath; if (processPath == null) { - ShowError("Launcher update failed", "Unable to obtain path to running process."); + OpenDownloadPage(); + return; + } + + FileAttributes fileAttributes = File.GetAttributes(processPath); + if ((fileAttributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) + { + OpenDownloadPage(); return; }