Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(shell): create parent dir before appending to rcfiles
Browse files Browse the repository at this point in the history
rami3l committed Mar 13, 2024

Verified

This commit was signed with the committer’s verified signature.
Emojigit 1F616EMO~nya
1 parent 822a13f commit d4efebc
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
@@ -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()))?;
}

0 comments on commit d4efebc

Please sign in to comment.