Skip to content

Commit

Permalink
FIX writing default config
Browse files Browse the repository at this point in the history
  • Loading branch information
synoet committed Aug 30, 2023
1 parent 6384075 commit d4d3317
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cmd/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::Path;
pub fn init_shell(config: Option<Config>, shell: Shell) -> Result<()> {
let home_var = std::env::var("HOME").context("no $HOME set")?;
let home = Path::new(&home_var);
let toml_path = std::path::Path::join(home, ".cdwe.toml")
let toml_path = std::path::Path::join(home, "cdwe.toml")
.to_str()
.context("failed to get toml path")?
.to_string();
Expand All @@ -33,7 +33,7 @@ pub fn init_shell(config: Option<Config>, shell: Shell) -> Result<()> {

std::fs::write(&shell_script_target, shell_script)?;

let toml_content: String = std::fs::read_to_string(&config_path).unwrap_or("".to_string());
let toml_content: String = std::fs::read_to_string(&toml_path).unwrap_or("".to_string());

if toml_content.is_empty() {
let default_config = Config::default_for_shell(shell);
Expand Down
5 changes: 1 addition & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ impl Config {
}),
directories: vec![EnvDirectory {
path: "~".to_string(),
vars: Some(HashMap::from([(
"CDWE_ENABLED".to_string(),
"true".to_string(),
)])),
vars: None,
load_from: None,
run: None,
aliases: None,
Expand Down

0 comments on commit d4d3317

Please sign in to comment.