Merge pull request #2185 from zed-industries/refactor-restart
Used the pre-existing app_path call in the GPUI platform
This commit is contained in:
commit
5cfe206433
1 changed files with 2 additions and 14 deletions
|
@ -810,25 +810,13 @@ impl platform::Platform for MacPlatform {
|
||||||
let path = std::env::current_exe();
|
let path = std::env::current_exe();
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
let path = unsafe {
|
let path = self.app_path().or_else(|_| std::env::current_exe());
|
||||||
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 command = path.and_then(|path| Command::new("/usr/bin/open").arg(path).spawn());
|
let command = path.and_then(|path| Command::new("/usr/bin/open").arg(path).spawn());
|
||||||
|
|
||||||
match command {
|
match command {
|
||||||
Err(err) => log::error!("Unable to restart application {}", err),
|
Err(err) => log::error!("Unable to restart application {}", err),
|
||||||
Ok(_) => self.quit(),
|
Ok(_child) => self.quit(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue