Move config file default path to os.UserConfigDir()
Related with https://github.com/schachmat/wego/issues/116
os.UserConfigDir() docs:
On Unix systems, it returns $XDG_CONFIG_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.config. On Darwin, it returns $HOME/Library/Application Support. On Windows, it returns %AppData%. On Plan 9, it returns $home/lib.
Currently .wegorc defaults to $HOME/.wegorc in all systems. I'm proposing this logic for searching/creating the config file:
-
$WEGORCtakes the highest precedence. - If
$WEGORCis not set, try to open the config file fromos.UserConfigDir()/wego/wegorc(can adjust the name, but the point is it is stored inside os.UserConfigDir) - If the config file is not found, fallback try to open the config file from
$HOME/.wegorcfor backward compatibility - If still now found, generate the config file
- in
$WEGORCif it is set - else, generate the file in
os.UserConfigDir()/wego/wegorc
- in
Hey, I wanna know the status about this issue, Is it updated? Else i can work on this
This seems like something which has to be updated in "ingo" rather than here Can you help me with this?
Yep, probably line 57 and following need adaption: https://github.com/schachmat/ingo/blob/master/in.go#L57
would love for this to be added as keeping config files where config files should be helps make things easier to find and keep tidy in your home dir