Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Used the pre-existing app_path call in the GPUI platform

Mikayla Makiff2fb06b2cc8
diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs
index 3db7c6eedc9..c2887eeb236 100644
--- a/crates/gpui/src/platform/mac/platform.rs
+++ b/crates/gpui/src/platform/mac/platform.rs
@@ -810,25 +810,13 @@ impl platform::Platform for MacPlatform {
let path = std::env::current_exe();
#[cfg(not(debug_assertions))]
- let path = unsafe {
- let bundle: id = NSBundle::mainBundle();
- if bundle.is_null() {
- std::env::current_exe()
- } else {
- let path: id = msg_send![bundle, bundlePath];
- let path: *mut c_char = msg_send![path, UTF8String];
-
- Ok(PathBuf::from(OsStr::from_bytes(
- CStr::from_ptr(path).to_bytes(),
- )))
- }
- };
+ let path = self.app_path().or_else(|_| std::env::current_exe());
let command = path.and_then(|path| Command::new("/usr/bin/open").arg(path).spawn());
match command {
Err(err) => log::error!("Unable to restart application {}", err),
- Ok(_) => self.quit(),
+ Ok(_child) => self.quit(),
}
}
}