diff options
author | Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> | 2023-02-08 22:08:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-09 04:08:15 +0100 |
commit | 7bae440d3a5f2ed9ca7f93d8e39d6e2935926d41 (patch) | |
tree | dafd301ef3b96f16c0eb2838b7df436da5670640 /Ryujinx.Ui.Common/Helper/OpenHelper.cs | |
parent | f1943fd0b65b74f164eec1f47a586a463fd4352a (diff) |
`ObjectiveC` Helper Class (#4286)1.1.613
* `NativeMacOS` Helper Class
* Corrections
* Make CFString IDisposable
* Fix `openURL:`
* `dealloc` metal layer
* Remove releases
* Use NSString
* Update Ryujinx.Ui.Common/Helper/NativeMacOS.cs
Co-authored-by: merry <git@mary.rs>
* Programatically select updates in Finder
* Address feedback
* Feedback
* Ptr
* Fix whoopsie
* Ack suggestions
* Update Ryujinx.Ava/UI/Renderer/EmbeddedWindow.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* GDK Suggestions
---------
Co-authored-by: merry <git@mary.rs>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'Ryujinx.Ui.Common/Helper/OpenHelper.cs')
-rw-r--r-- | Ryujinx.Ui.Common/Helper/OpenHelper.cs | 21 |
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 { |