Skip to content

Commit

Permalink
Move the create_dir_all call to get_history_path
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Mar 9, 2024
1 parent f76c838 commit f574c37
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions numbat-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ impl Cli {
let result = self.repl_loop(&mut rl, interactive);

if interactive {
// Create the prerequisite directories required to save history, if they don't exist already.
fs::create_dir_all(history_path.parent().unwrap())?;
rl.save_history(&history_path).context(format!(
"Error while saving history to '{}'",
history_path.to_string_lossy()
Expand Down Expand Up @@ -570,7 +568,7 @@ impl Cli {
let data_dir = dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("numbat");
fs::create_dir(&data_dir).ok();
fs::create_dir_all(&data_dir).ok();
Ok(data_dir.join("history"))
}
}
Expand Down

0 comments on commit f574c37

Please sign in to comment.