Skip to content

Commit

Permalink
Respecting XDG vars correctly
Browse files Browse the repository at this point in the history
distributions:  XDG_CONFIG_HOME + '/binenv/'
cache:          XDG_CACHE_HOME + '/binenv/'

馃Ж this might break tools relying on the old places!

Fixes #241
  • Loading branch information
Gunther Klessinger committed Sep 27, 2023
1 parent be730af commit 9ea9473
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -555,13 +555,16 @@ Two other environment variables exist:

## Removing binenv stuff

`binenv` stores downloaded binaries in `~/.binenv/binaries`, and a cache in
`~/.config/binenv/` (or whatever your `XDG_CONFIG` variable points to).
`binenv` stores

- downloaded binaries by default in `~/.binenv/binaries`
- the versions cache in `~/.cache/binenv/` (or wherever your `XDG_CACHE_HOME` variable points to)
- the list of known distributions in `~/.config/binenv/` (or wherever your `XDG_CONFIG_HOME` variable points to).

To wipe everything clean:

```bash
rm -rfi ~/.binenv ~/.config/binenv/
rm -rfi ~/.binenv ~/.config/binenv ~/.cache/binenv
```

Don't forget to remove the `PATH` and the completion you might have changed in
Expand Down
8 changes: 4 additions & 4 deletions internal/app/utils.go
Expand Up @@ -35,10 +35,10 @@ func GetDefaultConfDir() (string, error) {
if err != nil {
return "", err
}
d += "/.config/binenv"
d += "/.config"
}

return d, nil
return d + "/binenv", nil
}

// GetDefaultCacheDir returns the cache directory in usermode
Expand All @@ -51,10 +51,10 @@ func GetDefaultCacheDir() (string, error) {
if err != nil {
return "", err
}
d += "/.cache/binenv"
d += "/.cache"
}

return d, nil
return d + "/binenv", nil
}

func stringInSlice(st string, sl []string) bool {
Expand Down

0 comments on commit 9ea9473

Please sign in to comment.