Skip to content

Commit

Permalink
fix(cli): make quickstart config home-aware
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LGUG2Z committed Jun 2, 2024
1 parent a5fb552 commit f235100
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion komorebic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit f235100

Please sign in to comment.