Add ability to open files with system default application (#17231)
This commit is contained in:
parent
06142f975b
commit
ae3880e71a
10 changed files with 63 additions and 1 deletions
|
@ -718,6 +718,20 @@ impl Platform for MacPlatform {
|
|||
}
|
||||
}
|
||||
|
||||
fn open_with_system(&self, path: &Path) {
|
||||
let path = path.to_path_buf();
|
||||
self.0
|
||||
.lock()
|
||||
.background_executor
|
||||
.spawn(async move {
|
||||
std::process::Command::new("open")
|
||||
.arg(path)
|
||||
.spawn()
|
||||
.expect("Failed to open file");
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
fn on_quit(&self, callback: Box<dyn FnMut()>) {
|
||||
self.0.lock().quit = Some(callback);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue