From f23510055acfd70cf34e343f25526665ca361c7b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sun, 2 Jun 2024 08:55:18 -0700 Subject: [PATCH] fix(cli): make quickstart config home-aware This commit makes the quickstart command aware of the KOMOREBI_CONFIG_HOME environment variable. If this is set by the user, references to Env:USERPROFILE will be replaced with Env:KOMOREBI_CONFIG_HOME. fix #861 --- komorebic/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index 04fe1d77b..d017ed948 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -1309,7 +1309,12 @@ fn main() -> Result<()> { std::fs::create_dir_all(&config_dir)?; std::fs::create_dir_all(data_dir)?; - let komorebi_json = include_str!("../../docs/komorebi.example.json"); + let mut komorebi_json = include_str!("../../docs/komorebi.example.json").to_string(); + if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() { + komorebi_json = + komorebi_json.replace("Env:USERPROFILE", "Env:KOMOREBI_CONFIG_HOME"); + } + std::fs::write(HOME_DIR.join("komorebi.json"), komorebi_json)?; let applications_yaml = include_str!("../applications.yaml");