From e26a83299c6a8b3e3ba4528634f2c7e2cd290ebf Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 19 Jan 2025 16:44:53 -0800 Subject: [PATCH] Override config/data paths Without this the config is saved to $HOME/.config/core/config.json5 --- core/src/config.rs | 10 ++++++---- core/src/logging.rs | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/config.rs b/core/src/config.rs index 11de53f..9599e0d 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -52,14 +52,15 @@ pub struct Config { pub styles: Styles, } +pub static PROJECT_NAME: &'static str = "DEJA-VU"; lazy_static! { - pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase().to_string(); + //pub static ref PROJECT_NAME: String = env!("CARGO_PKG_NAME").to_uppercase().to_string(); pub static ref DATA_FOLDER: Option = - env::var(format!("{}_DATA", PROJECT_NAME.clone())) + env::var(format!("{}_DATA", PROJECT_NAME)) .ok() .map(PathBuf::from); pub static ref CONFIG_FOLDER: Option = - env::var(format!("{}_CONFIG", PROJECT_NAME.clone())) + env::var(format!("{}_CONFIG", PROJECT_NAME)) .ok() .map(PathBuf::from); } @@ -142,7 +143,8 @@ pub fn get_config_dir() -> PathBuf { } fn project_directory() -> Option { - ProjectDirs::from("com", "Deja-vu", env!("CARGO_PKG_NAME")) + ProjectDirs::from("com", "Deja-vu", "deja-vu") + //ProjectDirs::from("com", "Deja-vu", env!("CARGO_PKG_NAME")) } #[derive(Clone, Debug, Default, Deref, DerefMut)] diff --git a/core/src/logging.rs b/core/src/logging.rs index 2494013..2e8b40d 100644 --- a/core/src/logging.rs +++ b/core/src/logging.rs @@ -20,8 +20,9 @@ use tracing_subscriber::{fmt, prelude::*, EnvFilter}; use crate::config; lazy_static::lazy_static! { - pub static ref LOG_ENV: String = format!("{}_LOG_LEVEL", config::PROJECT_NAME.clone()); - pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME")); + pub static ref LOG_ENV: String = format!("{}_LOG_LEVEL", config::PROJECT_NAME); + pub static ref LOG_FILE: String = format!("{}.log", config::PROJECT_NAME); + //pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME")); } pub fn init() -> Result<()> {