mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 03:16:23 +02:00
misc: Some fixes to the updaters (#4092)
This was meant to be only an upgrade of how we set unix permission in the updater to use .NET 7 new APIs, but I end up finding bugs along the way. Changelog: - Remove direct usage of chmod to use File.SetUnixFileMode. - Fix command line being broken when updating (#3744) but on Ryujinx.Ava. - Makes Ryujinx.Ava updater fallback to Ryujinx executable if current name isn't found. - Make permission setter function more generic.
This commit is contained in:
parent
475fa4d390
commit
6fe88115a3
2 changed files with 28 additions and 20 deletions
|
@ -387,16 +387,19 @@ namespace Ryujinx.Modules
|
|||
worker.Start();
|
||||
}
|
||||
|
||||
[DllImport("libc", SetLastError = true)]
|
||||
private static extern int chmod(string path, uint mode);
|
||||
|
||||
private static void SetUnixPermissions()
|
||||
private static void SetFileExecutable(string path)
|
||||
{
|
||||
string ryuBin = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx");
|
||||
const UnixFileMode ExecutableFileMode = UnixFileMode.UserExecute |
|
||||
UnixFileMode.UserWrite |
|
||||
UnixFileMode.UserRead |
|
||||
UnixFileMode.GroupRead |
|
||||
UnixFileMode.GroupWrite |
|
||||
UnixFileMode.OtherRead |
|
||||
UnixFileMode.OtherWrite;
|
||||
|
||||
if (!OperatingSystem.IsWindows())
|
||||
if (!OperatingSystem.IsWindows() && File.Exists(path))
|
||||
{
|
||||
chmod(ryuBin, 493);
|
||||
File.SetUnixFileMode(path, ExecutableFileMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,7 +522,7 @@ namespace Ryujinx.Modules
|
|||
|
||||
Directory.Delete(UpdateDir, true);
|
||||
|
||||
SetUnixPermissions();
|
||||
SetFileExecutable(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx"));
|
||||
|
||||
updateDialog.MainText.Text = "Update Complete!";
|
||||
updateDialog.SecondaryText.Text = "Do you want to restart Ryujinx now?";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue