mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Add url schemes to Zed
This commit is contained in:
parent
37de4a9990
commit
a63eccf188
@ -1,6 +1,7 @@
|
||||
use std::env;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use url::Url;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref RELEASE_CHANNEL_NAME: String = if cfg!(debug_assertions) {
|
||||
@ -15,6 +16,23 @@ lazy_static! {
|
||||
"stable" => ReleaseChannel::Stable,
|
||||
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
|
||||
};
|
||||
|
||||
static ref URL_SCHEME: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {
|
||||
"dev" => "zed-dev:/",
|
||||
"preview" => "zed-preview:/",
|
||||
"stable" => "zed:/",
|
||||
// NOTE: this must be kept in sync with ./script/bundle and https://zed.dev.
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.unwrap();
|
||||
static ref LINK_PREFIX: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {
|
||||
"dev" => "http://localhost:3000/dev/",
|
||||
"preview" => "https://zed.dev/preview/",
|
||||
"stable" => "https://zed.dev/",
|
||||
// NOTE: this must be kept in sync with https://zed.dev.
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Default)]
|
||||
@ -41,4 +59,12 @@ impl ReleaseChannel {
|
||||
ReleaseChannel::Stable => "stable",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn url_scheme(&self) -> &'static Url {
|
||||
&URL_SCHEME
|
||||
}
|
||||
|
||||
pub fn link_prefix(&self) -> &'static Url {
|
||||
&LINK_PREFIX
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ identifier = "dev.zed.Zed-Dev"
|
||||
name = "Zed Dev"
|
||||
osx_minimum_system_version = "10.15.7"
|
||||
osx_info_plist_exts = ["resources/info/*"]
|
||||
osx_url_schemes = ["zed-dev"]
|
||||
|
||||
[package.metadata.bundle-preview]
|
||||
icon = ["resources/app-icon-preview@2x.png", "resources/app-icon-preview.png"]
|
||||
@ -169,6 +170,7 @@ identifier = "dev.zed.Zed-Preview"
|
||||
name = "Zed Preview"
|
||||
osx_minimum_system_version = "10.15.7"
|
||||
osx_info_plist_exts = ["resources/info/*"]
|
||||
osx_url_schemes = ["zed-preview"]
|
||||
|
||||
|
||||
[package.metadata.bundle-stable]
|
||||
@ -177,3 +179,4 @@ identifier = "dev.zed.Zed"
|
||||
name = "Zed"
|
||||
osx_minimum_system_version = "10.15.7"
|
||||
osx_info_plist_exts = ["resources/info/*"]
|
||||
osx_url_schemes = ["zed"]
|
||||
|
Loading…
Reference in New Issue
Block a user