From 6dcd9ed7df6e2f9530c8627b7168da2dc573cf9f Mon Sep 17 00:00:00 2001 From: Penwing Date: Wed, 24 Jan 2024 22:34:25 +0100 Subject: [PATCH] save state depend on build mode --- Cargo.toml | 4 ---- README.md | 1 + src/main.rs | 9 ++++++--- src/tools/mod.rs | 2 ++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index feb57d6..f48d1db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,10 +7,6 @@ edition = "2021" [dependencies] eframe = "0.25.0" -# env_logger = { version = "0.10.1", default-features = false, features = [ - # "auto-color", - # "humantime", -# ] } rfd = "0.12.1" egui_extras = "0.25.0" image = "0.24.8" diff --git a/README.md b/README.md index 103461b..56bc015 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,4 @@ Max framerate => 30 fps (less cpu usage) # 1.0.4 : Added close tab and refresh confirm prompt +Async terminal ! diff --git a/src/main.rs b/src/main.rs index 6bb11bd..6892585 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,9 +7,14 @@ use std::{path::Path, sync::Arc, time, thread}; use calcifer::code_editor::themes::DEFAULT_THEMES; +#[cfg(debug_assertions)] +const SAVE_PATH : &str = "/home/penwing/Documents/.saves/debug/calcifer_save.json"; + +#[cfg(not(debug_assertions))] +const SAVE_PATH : &str = "/home/penwing/Documents/.saves/calcifer_save.json"; + const TERMINAL_HEIGHT : f32 = 200.0; const RED : egui::Color32 = egui::Color32::from_rgb(235, 108, 99); -const SAVE_PATH : &str = "/home/penwing/Documents/.saves/calcifer_save.json"; const TIME_LABELS : [&str; 5] = ["settings", "tree", "terminal", "tabs", "content"]; const MAX_FPS : f32 = 30.0; const PATH_ROOT : &str = "/home/penwing/Documents/"; @@ -19,8 +24,6 @@ const MAX_TABS : usize = 20; fn main() -> Result<(), eframe::Error> { let icon_data = tools::load_icon(); - - //env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() .with_inner_size([1200.0, 800.0]) diff --git a/src/tools/mod.rs b/src/tools/mod.rs index e93c441..3a22204 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -36,6 +36,8 @@ pub fn save_state(state: &AppState, file_path: &str) -> Result<(), std::io::Erro .open(file_path)?; file.write_all(serialized_state.as_bytes())?; + + println!("Saved state at {}", file_path); Ok(()) }