Archived
1
0
Fork 0
forked from Mirror/Ryujinx

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
This commit is contained in:
pineappleEA 2021-02-25 01:35:48 +02:00 committed by GitHub
parent fa55d7133a
commit 1c49089ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View file

@ -51,12 +51,6 @@ namespace Ryujinx.Modules
string ryuExe = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ryuName); string ryuExe = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ryuName);
string ryuArg = string.Join(" ", Environment.GetCommandLineArgs().AsEnumerable().Skip(1).ToArray()); 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); Process.Start(ryuExe, ryuArg);
Environment.Exit(0); Environment.Exit(0);

View file

@ -2,6 +2,7 @@ using Gtk;
using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip;
using Mono.Unix;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Ui; 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) private static async void InstallUpdate(UpdateDialog updateDialog, string updateFile)
{ {
// Extract Update // Extract Update
@ -444,6 +456,8 @@ namespace Ryujinx.Modules
Directory.Delete(UpdateDir, true); Directory.Delete(UpdateDir, true);
SetUnixPermissions();
updateDialog.MainText.Text = "Update Complete!"; updateDialog.MainText.Text = "Update Complete!";
updateDialog.SecondaryText.Text = "Do you want to restart Ryujinx now?"; updateDialog.SecondaryText.Text = "Do you want to restart Ryujinx now?";
updateDialog.Modal = true; updateDialog.Modal = true;