Skip to content

Commit

Permalink
fix(shell): create parent dir before appending to rcfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Mar 16, 2024
1 parent 491d356 commit 6e8769c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli/self_update/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ pub(crate) fn do_add_to_path() -> Result<()> {
_ => &source_cmd,
};

let rc_dir = rc.parent().with_context(|| {
format!(
"parent directory doesn't exist for rcfile path: `{}`",
rc.display()
)
})?;
utils::ensure_dir_exists("rcfile dir", rc_dir, &|_: Notification<'_>| ())?;
utils::append_file("rcfile", &rc, cmd_to_write)
.with_context(|| format!("could not amend shell profile: '{}'", rc.display()))?;
}
Expand Down

0 comments on commit 6e8769c

Please sign in to comment.