mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-05 01:38:55 +02:00
Linux: Fix file picker not launching from disabling core dumps
Core dumps are disabled by default on Linux, but this prevents access to the file picker due to security hardening. To work around this, core dumps are selectively enabled and disabled around the file picker tasks.
This commit is contained in:
@@ -3,6 +3,7 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.VisualTree;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -20,6 +21,8 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
|
||||
private async void AddGameDirButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(true);
|
||||
|
||||
string path = GameDirPathBox.Text;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path))
|
||||
@@ -43,6 +46,11 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Program.CoreDumpArg)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveGameDirButton_OnClick(object sender, RoutedEventArgs e)
|
||||
@@ -63,6 +71,8 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
|
||||
private async void AddAutoloadDirButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(true);
|
||||
|
||||
string path = AutoloadDirPathBox.Text;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.AutoloadDirectories.Contains(path))
|
||||
@@ -86,6 +96,11 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Program.CoreDumpArg)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAutoloadDirButton_OnClick(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -8,6 +8,7 @@ using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.UI.Controls;
|
||||
using Ryujinx.Ava.UI.Models;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using SkiaSharp;
|
||||
using System.Collections.Generic;
|
||||
@@ -63,6 +64,8 @@ namespace Ryujinx.Ava.UI.Views.User
|
||||
|
||||
private async void Import_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(true);
|
||||
|
||||
if (this.GetVisualRoot() is Window window)
|
||||
{
|
||||
var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
@@ -85,6 +88,11 @@ namespace Ryujinx.Ava.UI.Views.User
|
||||
_parent.GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
if (!Program.CoreDumpArg)
|
||||
{
|
||||
OsUtils.SetCoreDumpable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void GoBack(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user