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:
co-authored by
Nathan Sobo
Max Brunsfeld
Keith Simmons
parent
cbf6d827db
commit
38e902b241
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{CursorStyle, WindowBounds};
|
||||
use super::{AppVersion, CursorStyle, WindowBounds};
|
||||
use crate::{
|
||||
geometry::vector::{vec2f, Vector2F},
|
||||
AnyAction, ClipboardItem,
|
||||
@@ -164,6 +164,14 @@ impl super::Platform for Platform {
|
||||
fn path_for_resource(&self, _name: Option<&str>, _extension: Option<&str>) -> Result<PathBuf> {
|
||||
Err(anyhow!("app not running inside a bundle"))
|
||||
}
|
||||
|
||||
fn app_version(&self) -> Result<AppVersion> {
|
||||
Ok(AppVersion {
|
||||
major: 1,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Window {
|
||||
|
||||
Reference in New Issue
Block a user