Move reveal_path to ForegroundPlatform
So that we can use spawn to use the OS API call. Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
efafd1d8d3
commit
4bb986b3be
6 changed files with 57 additions and 24 deletions
|
@ -190,8 +190,8 @@ pub struct AsyncAppContext(Rc<RefCell<MutableAppContext>>);
|
|||
impl App {
|
||||
pub fn new(asset_source: impl AssetSource) -> Result<Self> {
|
||||
let platform = platform::current::platform();
|
||||
let foreground_platform = platform::current::foreground_platform();
|
||||
let foreground = Rc::new(executor::Foreground::platform(platform.dispatcher())?);
|
||||
let foreground_platform = platform::current::foreground_platform(foreground.clone());
|
||||
let app = Self(Rc::new(RefCell::new(MutableAppContext::new(
|
||||
foreground,
|
||||
Arc::new(executor::Background::new()),
|
||||
|
@ -900,6 +900,10 @@ impl MutableAppContext {
|
|||
self.foreground_platform.prompt_for_new_path(directory)
|
||||
}
|
||||
|
||||
pub fn reveal_path(&self, path: &Path) {
|
||||
self.foreground_platform.reveal_path(path)
|
||||
}
|
||||
|
||||
pub fn emit_global<E: Any>(&mut self, payload: E) {
|
||||
self.pending_effects.push_back(Effect::GlobalEvent {
|
||||
payload: Box::new(payload),
|
||||
|
@ -3637,6 +3641,10 @@ impl<'a, T: View> ViewContext<'a, T> {
|
|||
self.app.prompt_for_new_path(directory)
|
||||
}
|
||||
|
||||
pub fn reveal_path(&self, path: &Path) {
|
||||
self.app.reveal_path(path)
|
||||
}
|
||||
|
||||
pub fn debug_elements(&self) -> crate::json::Value {
|
||||
self.app.debug_elements(self.window_id).unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue