aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ui.Common/Helper/OpenHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Ui.Common/Helper/OpenHelper.cs')
-rw-r--r--Ryujinx.Ui.Common/Helper/OpenHelper.cs21
1 files changed, 19 insertions, 2 deletions
diff --git a/Ryujinx.Ui.Common/Helper/OpenHelper.cs b/Ryujinx.Ui.Common/Helper/OpenHelper.cs
index 35534892..5b2e8663 100644
--- a/Ryujinx.Ui.Common/Helper/OpenHelper.cs
+++ b/Ryujinx.Ui.Common/Helper/OpenHelper.cs
@@ -55,7 +55,17 @@ namespace Ryujinx.Ui.Common.Helper
}
else if (OperatingSystem.IsMacOS())
{
- Process.Start("open", $"-R \"{path}\"");
+ ObjectiveC.NSString nsStringPath = new(path);
+ IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
+ var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "fileURLWithPath:", nsStringPath);
+
+ IntPtr nsArray = ObjectiveC.objc_getClass("NSArray");
+ IntPtr urlArray = ObjectiveC.IntPtr_objc_msgSend(nsArray, "arrayWithObject:", urlPtr);
+
+ IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
+ IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
+
+ ObjectiveC.objc_msgSend(sharedWorkspace, "activateFileViewerSelectingURLs:", urlArray);
}
else if (OperatingSystem.IsLinux())
{
@@ -84,7 +94,14 @@ namespace Ryujinx.Ui.Common.Helper
}
else if (OperatingSystem.IsMacOS())
{
- Process.Start("open", url);
+ ObjectiveC.NSString nsStringPath = new(url);
+ IntPtr nsUrl = ObjectiveC.objc_getClass("NSURL");
+ var urlPtr = ObjectiveC.IntPtr_objc_msgSend(nsUrl, "URLWithString:", nsStringPath);
+
+ IntPtr nsWorkspace = ObjectiveC.objc_getClass("NSWorkspace");
+ IntPtr sharedWorkspace = ObjectiveC.IntPtr_objc_msgSend(nsWorkspace, "sharedWorkspace");
+
+ ObjectiveC.bool_objc_msgSend(sharedWorkspace, "openURL:", urlPtr);
}
else
{