Introduce reveal_path in Platform

And implement it for MacPlatform, and instead of using an external process to run `open`, use the NSWorkspace selectFile instance method.
This commit is contained in:
Petros Amoiridis 2023-02-14 15:14:15 +02:00
parent 9143790602
commit 015b8db1c3
No known key found for this signature in database
5 changed files with 19 additions and 14 deletions

View file

@ -599,6 +599,19 @@ impl platform::Platform for MacPlatform {
}
}
fn reveal_path(&self, path: &Path) {
unsafe {
let full_path = ns_string(path.to_str().unwrap_or(""));
let root_full_path = ns_string("");
let workspace: id = msg_send![class!(NSWorkspace), sharedWorkspace];
msg_send![
workspace,
selectFile: full_path
inFileViewerRootedAtPath: root_full_path
]
}
}
fn write_credentials(&self, url: &str, username: &str, password: &[u8]) -> Result<()> {
let url = CFString::from(url);
let username = CFString::from(username);