From 1c49089ff00fc87dc4872f135dc6a0d36169a970 Mon Sep 17 00:00:00 2001 From: pineappleEA <67879877+pineappleEA@users.noreply.github.com> Date: Thu, 25 Feb 2021 01:35:48 +0200 Subject: [PATCH] Fix updater breaking user execute permissions on Unix (#2055) * Fix updater breaking user run permissions on *nix The updater currently sets the permissions to user run only when the yes button is clicked, this changes it to run on Updater.cs after it's done updating as it should. * Fix nits --- Ryujinx/Modules/Updater/UpdateDialog.cs | 8 +------- Ryujinx/Modules/Updater/Updater.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Ryujinx/Modules/Updater/UpdateDialog.cs b/Ryujinx/Modules/Updater/UpdateDialog.cs index 193b9bc396..81727769b2 100644 --- a/Ryujinx/Modules/Updater/UpdateDialog.cs +++ b/Ryujinx/Modules/Updater/UpdateDialog.cs @@ -42,7 +42,7 @@ namespace Ryujinx.Modules YesButton.Clicked += YesButton_Clicked; NoButton.Clicked += NoButton_Clicked; } - + private void YesButton_Clicked(object sender, EventArgs args) { if (_restartQuery) @@ -51,12 +51,6 @@ namespace Ryujinx.Modules string ryuExe = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ryuName); string ryuArg = string.Join(" ", Environment.GetCommandLineArgs().AsEnumerable().Skip(1).ToArray()); - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - UnixFileInfo unixFileInfo = new UnixFileInfo(ryuExe); - unixFileInfo.FileAccessPermissions |= FileAccessPermissions.UserExecute; - } - Process.Start(ryuExe, ryuArg); Environment.Exit(0); diff --git a/Ryujinx/Modules/Updater/Updater.cs b/Ryujinx/Modules/Updater/Updater.cs index b4fe33516b..c7def9600a 100644 --- a/Ryujinx/Modules/Updater/Updater.cs +++ b/Ryujinx/Modules/Updater/Updater.cs @@ -2,6 +2,7 @@ using Gtk; using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; +using Mono.Unix; using Newtonsoft.Json.Linq; using Ryujinx.Common.Logging; using Ryujinx.Ui; @@ -325,6 +326,17 @@ namespace Ryujinx.Modules } } + private static void SetUnixPermissions() + { + string ryuBin = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx"); + + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + UnixFileInfo unixFileInfo = new UnixFileInfo(ryuBin); + unixFileInfo.FileAccessPermissions |= FileAccessPermissions.UserExecute; + } + } + private static async void InstallUpdate(UpdateDialog updateDialog, string updateFile) { // Extract Update @@ -444,6 +456,8 @@ namespace Ryujinx.Modules Directory.Delete(UpdateDir, true); + SetUnixPermissions(); + updateDialog.MainText.Text = "Update Complete!"; updateDialog.SecondaryText.Text = "Do you want to restart Ryujinx now?"; updateDialog.Modal = true;