distributions.yaml put to unexpected location
axgkl opened this issue · 3 comments
Hi, again.
distributions.yaml
is put to "$HOME/.config" instead "$HOME/.config/binenv" when $XDG_ CONFIG_HOME
is set - i.e. on a linux box nowadays to $HOME/.config
.
// GetDefaultConfDir returns the config directory in usermode
func GetDefaultConfDir() (string, error) {
var err error
d := os.Getenv("XDG_CONFIG_HOME")
if d == "" {
d, err = homedir.Dir()
if err != nil {
return "", err
}
d += "/.config/binenv"
}
return d, nil
}
Should be imho return d+"/binenv"
always (and d+="/.config"
only), no?
PS: In the readme you write about XDG_CONFIG, a variable which I don't see even looked at, looking at the code
All your remarks are totally correct, thanks !
Would you like to send a PR ?
done but I have no go toolchain here, could not test => are you making sure those directories are created before writing the files?
And see my note, this is not backwards compat, just sayin ;-)
are you making sure those directories are created before writing the files?
yes
And see my note, this is not backwards compat, just sayin
yes, should not be a problem; distribution will be fetched automatically & cache will have to be updated with binenv update
.
$ rm ~/.config/binenv/distributions.yaml; binenv -v search kubectl
2023-09-28T06:27:05+02:00 DBG setting configuration bindir=/home/xxx/.binenv/
2023-09-28T06:27:05+02:00 DBG setting configuration linkdir=/home/xxx/.binenv/
2023-09-28T06:27:05+02:00 DBG setting configuration configdir=/home/xxx/.config/binenv
2023-09-28T06:27:05+02:00 DBG setting configuration cachedir=/home/xxx/.cache/binenv
2023-09-28T06:27:05+02:00 DBG final configuration bindir=/home/xxx/.binenv/ cachedir=/home/xxx/.cache/binenv configdir=/home/xxx/.config/binenv linkdir=/home/leucos/.binenv/
2023-09-28T06:27:05+02:00 INF updating distribution list
2023-09-28T06:27:05+02:00 DBG retrieving distribution list from https://raw.githubusercontent.com/devops-works/binenv/master/distributions/distributions.yaml