Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix crash when launching `Zed.exe` directly from `target/debug` dir (#9112)
张小白2abb5aeaf228
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 73350bcda7f..d1f927dfd07 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -184,8 +184,6 @@ fn main() {load_user_themes_in_background(fs.clone(), cx);watch_themes(fs.clone(), cx);- cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))- .detach();watch_file_types(fs.clone(), cx);languages.set_theme(cx.theme().clone());@@ -1004,32 +1002,20 @@ fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {.detach()}-#[cfg(debug_assertions)]-async fn watch_languages(fs: Arc<dyn fs::Fs>, languages: Arc<LanguageRegistry>) {- use std::time::Duration;-- let reload_debounce = Duration::from_millis(250);-- let mut events = fs- .watch("crates/zed/src/languages".as_ref(), reload_debounce)- .await;-- while (events.next().await).is_some() {- languages.reload();- }-}-#[cfg(debug_assertions)]fn watch_file_types(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {use std::time::Duration;+ let path = {+ let p = Path::new("assets/icons/file_icons/file_types.json");+ let Ok(full_path) = p.canonicalize() else {+ return;+ };+ full_path+ };+cx.spawn(|cx| async move {- let mut events = fs- .watch(- "assets/icons/file_icons/file_types.json".as_ref(),- Duration::from_millis(100),- )- .await;+ let mut events = fs.watch(path.as_path(), Duration::from_millis(100)).await;while (events.next().await).is_some() {cx.update(|cx| {cx.update_global(|file_types, _| {@@ -1044,6 +1030,3 @@ fn watch_file_types(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {#[cfg(not(debug_assertions))]fn watch_file_types(_fs: Arc<dyn fs::Fs>, _cx: &mut AppContext) {}--#[cfg(not(debug_assertions))]-async fn watch_languages(_fs: Arc<dyn fs::Fs>, _languages: Arc<LanguageRegistry>) {}