ObjectiveC
Helper Class (#4286)
* `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>
This commit is contained in:
parent
f1943fd0b6
commit
7bae440d3a
4 changed files with 141 additions and 132 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue