Pull app / OS info out of GPUI, add Linux information, make fallible window initialization (#12869)
TODO: - [x] Finish GPUI changes on other operating systems This is a largely internal change to how we report data to our diagnostics and telemetry. This PR also includes an update to our blade backend which allows us to report errors in a more useful way when failing to initialize blade. Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
ec9e700e70
commit
80c14c9198
50 changed files with 571 additions and 550 deletions
|
@ -59,20 +59,21 @@ impl AppVersion {
|
|||
/// 1. the `ZED_APP_VERSION` environment variable,
|
||||
/// 2. the [`AppContext::app_metadata`],
|
||||
/// 3. the passed in `pkg_version`.
|
||||
pub fn init(pkg_version: &str, cx: &mut AppContext) {
|
||||
let version = if let Ok(from_env) = env::var("ZED_APP_VERSION") {
|
||||
pub fn init(pkg_version: &str) -> SemanticVersion {
|
||||
if let Ok(from_env) = env::var("ZED_APP_VERSION") {
|
||||
from_env.parse().expect("invalid ZED_APP_VERSION")
|
||||
} else {
|
||||
cx.app_metadata()
|
||||
.app_version
|
||||
.unwrap_or_else(|| pkg_version.parse().expect("invalid version in Cargo.toml"))
|
||||
};
|
||||
cx.set_global(GlobalAppVersion(version))
|
||||
pkg_version.parse().expect("invalid version in Cargo.toml")
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the global version number.
|
||||
pub fn global(cx: &AppContext) -> SemanticVersion {
|
||||
cx.global::<GlobalAppVersion>().0
|
||||
if cx.has_global::<GlobalAppVersion>() {
|
||||
cx.global::<GlobalAppVersion>().0
|
||||
} else {
|
||||
SemanticVersion::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,8 +101,8 @@ struct GlobalReleaseChannel(ReleaseChannel);
|
|||
impl Global for GlobalReleaseChannel {}
|
||||
|
||||
/// Initializes the release channel.
|
||||
pub fn init(pkg_version: &str, cx: &mut AppContext) {
|
||||
AppVersion::init(pkg_version, cx);
|
||||
pub fn init(app_version: SemanticVersion, cx: &mut AppContext) {
|
||||
cx.set_global(GlobalAppVersion(app_version));
|
||||
cx.set_global(GlobalReleaseChannel(*RELEASE_CHANNEL))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue