From c38c2f545240ffffe6842be093132720155014a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Wed, 24 Jan 2024 09:45:34 -0800 Subject: [PATCH] feat: use env vars for debug features Instead of branching behaviour based on debug assertions, check for environment variables and use those instead. --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b6508f6..03e7bb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -411,8 +411,8 @@ pub fn get_latest_stable_release( } pub fn get_app_name() -> Option { - if cfg!(debug_assertions) { - Some("cargo-dist".to_owned()) + if let Some(name) = env::var("AXOUPDATER_APP_NAME").ok() { + Some(name) } else if let Some(path) = args().next() { Utf8PathBuf::from(&path) .file_name() @@ -425,7 +425,7 @@ pub fn get_app_name() -> Option { } pub fn get_config_path(app_name: &String) -> AxoupdateResult { - if cfg!(debug_assertions) { + if env::var("AXOUPDATER_CONFIG_WORKING_DIR").is_ok() { Ok(Utf8PathBuf::try_from(current_dir()?)?) } else { let Some(home) = homedir::get_my_home()? else {