diff --git a/deja_vu/.envrc b/deja_vu/.envrc deleted file mode 100644 index dd7b181..0000000 --- a/deja_vu/.envrc +++ /dev/null @@ -1,3 +0,0 @@ -export DEJA_VU_CONFIG=`pwd`/config -export DEJA_VU_DATA=`pwd`/data -export DEJA_VU_LOG_LEVEL=debug diff --git a/deja_vu/Cargo.toml b/deja_vu/Cargo.toml index 2a1c29a..592fcb5 100644 --- a/deja_vu/Cargo.toml +++ b/deja_vu/Cargo.toml @@ -21,7 +21,6 @@ edition = "2021" license = "GPL" version = "0.2.0" - # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/deja_vu/config/config.json5 b/deja_vu/config/config.json5 index bb9e684..54e41f5 100644 --- a/deja_vu/config/config.json5 +++ b/deja_vu/config/config.json5 @@ -1,4 +1,5 @@ { + "app_title": "Deja-vu: Clone Tool", "clone_app_path": "C:/Program Files/Some Clone Tool/app.exe", "keybindings": { "ScanDisks": { diff --git a/deja_vu/src/app.rs b/deja_vu/src/app.rs index f68b066..e9c0a24 100644 --- a/deja_vu/src/app.rs +++ b/deja_vu/src/app.rs @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with Deja-vu. If not, see . // + use std::{ env, iter::zip, diff --git a/deja_vu/src/components/title.rs b/deja_vu/src/components/title.rs index 1394186..243b064 100644 --- a/deja_vu/src/components/title.rs +++ b/deja_vu/src/components/title.rs @@ -56,7 +56,7 @@ impl Component for Title { fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> { // Title Block let title_text = Span::styled( - "WizardKit: Clone Tool", + self.config.app_title.as_str(), Style::default().fg(Color::LightCyan), ); let title = Paragraph::new(Line::from(title_text).centered()) diff --git a/deja_vu/src/config.rs b/deja_vu/src/config.rs index f21ca83..ba2daab 100644 --- a/deja_vu/src/config.rs +++ b/deja_vu/src/config.rs @@ -40,6 +40,8 @@ pub struct AppConfig { #[derive(Clone, Debug, Default, Deserialize)] pub struct Config { + #[serde(default)] + pub app_title: String, #[serde(default)] pub clone_app_path: PathBuf, #[serde(default, flatten)] @@ -68,12 +70,13 @@ impl Config { let data_dir = get_data_dir(); let config_dir = get_config_dir(); let mut builder = config::Config::builder() - .set_default("data_dir", data_dir.to_str().unwrap())? - .set_default("config_dir", config_dir.to_str().unwrap())? + .set_default("app_title", default_config.app_title.as_str())? .set_default( "clone_app_path", String::from("C:\\Program Files\\Some Clone Tool\\app.exe"), - )?; + )? + .set_default("config_dir", config_dir.to_str().unwrap())? + .set_default("data_dir", data_dir.to_str().unwrap())?; let config_files = [ ("config.json5", config::FileFormat::Json5), @@ -95,7 +98,6 @@ impl Config { if !found_config { error!("No configuration file found. Application may not behave as expected"); } - let mut cfg: Self = builder.build()?.try_deserialize()?; for (mode, default_bindings) in default_config.keybindings.iter() { @@ -140,7 +142,7 @@ pub fn get_config_dir() -> PathBuf { } fn project_directory() -> Option { - ProjectDirs::from("com", "WizardKit", env!("CARGO_PKG_NAME")) + ProjectDirs::from("com", "Deja-vu", env!("CARGO_PKG_NAME")) } #[derive(Clone, Debug, Default, Deref, DerefMut)]