WIP: Start on auto-update
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Max Brunsfeld <max@zed.dev> Co-Authored-By: Keith Simmons <keith@zed.dev>
This commit is contained in:
parent
cbf6d827db
commit
38e902b241
8 changed files with 189 additions and 20 deletions
|
@ -623,6 +623,22 @@ impl platform::Platform for MacPlatform {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn app_version(&self) -> Result<platform::AppVersion> {
|
||||
unsafe {
|
||||
let bundle: id = NSBundle::mainBundle();
|
||||
if bundle.is_null() {
|
||||
Err(anyhow!("app is not running inside a bundle"))
|
||||
} else {
|
||||
let version: id =
|
||||
msg_send![bundle, objectForInfoDictionaryKey: "CFBundleShortVersionString"];
|
||||
let len = msg_send![version, lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
|
||||
let bytes = version.UTF8String() as *const u8;
|
||||
let version = str::from_utf8(slice::from_raw_parts(bytes, len)).unwrap();
|
||||
version.parse()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_foreground_platform(object: &mut Object) -> &MacForegroundPlatform {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue