From b20aefc8421a12cba07c8f86a27249f634ce18d9 Mon Sep 17 00:00:00 2001 From: Isaac Clayton Date: Fri, 22 Jul 2022 09:43:15 +0200 Subject: [PATCH] First draft for opening Zed.log --- crates/zed/src/zed.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 867913fc7b..709dc31f64 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -52,6 +52,7 @@ actions!( Quit, DebugElements, OpenSettings, + OpenLog, OpenKeymap, OpenDefaultSettings, OpenDefaultKeymap, @@ -65,9 +66,10 @@ actions!( const MIN_FONT_SIZE: f32 = 6.0; lazy_static! { - pub static ref ROOT_PATH: PathBuf = dirs::home_dir() - .expect("failed to determine home directory") - .join(".zed"); + pub static ref HOME_PATH: PathBuf = + dirs::home_dir().expect("failed to determine home directory"); + pub static ref LOG_PATH: PathBuf = HOME_PATH.join("Library/Logs/Zed/Zed.log"); + pub static ref ROOT_PATH: PathBuf = HOME_PATH.join(".zed"); pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json"); pub static ref KEYMAP_PATH: PathBuf = ROOT_PATH.join("keymap.json"); } @@ -120,6 +122,12 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { }); } }); + cx.add_action({ + let app_state = app_state.clone(); + move |_: &mut Workspace, _: &OpenLog, cx: &mut ViewContext| { + open_config_file(&LOG_PATH, app_state.clone(), cx, || Default::default()); + } + }); cx.add_action({ let app_state = app_state.clone(); move |_: &mut Workspace, _: &OpenKeymap, cx: &mut ViewContext| {