Override config/data paths
Without this the config is saved to $HOME/.config/core/config.json5
This commit is contained in:
parent
14a8ea7429
commit
e26a83299c
2 changed files with 9 additions and 6 deletions
|
|
@ -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<PathBuf> =
|
||||
env::var(format!("{}_DATA", PROJECT_NAME.clone()))
|
||||
env::var(format!("{}_DATA", PROJECT_NAME))
|
||||
.ok()
|
||||
.map(PathBuf::from);
|
||||
pub static ref CONFIG_FOLDER: Option<PathBuf> =
|
||||
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> {
|
||||
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)]
|
||||
|
|
|
|||
|
|
@ -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<()> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue