Repository: LPGhatguy/aftman (language: rust)

Issue:
aftman self-install fails on zsh environment
Following from [the discussion on #28](https://github.com/LPGhatguy/aftman/pull/28#issuecomment-1218281284):

On Ubuntu 22.04, I also had issues running `aftman self-install` without sudo. Without running as sudo I get this error:
```
./aftman self-install
[INFO  aftman::tool_storage] Updating all Aftman binaries...
[INFO  aftman::tool_storage] Updated Aftman binaries successfully!
[ERROR aftman::system_path::unix] Error trying to write /home/overhash/.zshenv: failed to open file `/home/overhash/.zshenv`
```
What's more interesting is that when I do use `sudo ./aftman self-install`, it still won't update the `zshenv`. I had to manually move my `.zshenv` to a new file and then run `aftman self-install` (which created a fresh `~/.zshenv`) before I merged my old changes in.

Most interestingly, all files are `chmod 644`. Running `aftman self-install` again after installing still causes the issue. I'm suspecting there's something funny going on here when actually reading the file.

Running off 652c4dfa230acf38cb77d94893c3001772822e8c.


Discussion / hints:
I encountered this helping someone as well I believe. I think I found the fix for it already and completely forgot. I'll see about opening a pull request for it later.

Fix patch:
diff --git a/src/system_path/unix.rs b/src/system_path/unix.rs
index cee1987..344cc99 100644
--- a/src/system_path/unix.rs
+++ b/src/system_path/unix.rs
@@ -55,11 +55,7 @@ fn append_line_if_not_present(path: &Path, line: &str, create: bool) -> anyhow::
         _ => false,
     };
 
-    let mut file = match OpenOptions::new()
-        .create_new(create)
-        .append(true)
-        .open(path)
-    {
+    let mut file = match OpenOptions::new().create(create).append(true).open(path) {
         Ok(file) => file,
         Err(err) => {
             if err.kind() != io::ErrorKind::NotFound {


Test patch: