wego icon indicating copy to clipboard operation
wego copied to clipboard

Move config file default path to os.UserConfigDir()

Open wijayaerick opened this issue 3 years ago • 4 comments

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:

  1. $WEGORC takes the highest precedence.
  2. If $WEGORC is not set, try to open the config file from os.UserConfigDir()/wego/wegorc (can adjust the name, but the point is it is stored inside os.UserConfigDir)
  3. If the config file is not found, fallback try to open the config file from $HOME/.wegorc for backward compatibility
  4. If still now found, generate the config file
    • in $WEGORC if it is set
    • else, generate the file in os.UserConfigDir()/wego/wegorc

wijayaerick avatar Dec 30 '22 09:12 wijayaerick

Hey, I wanna know the status about this issue, Is it updated? Else i can work on this

Madraceee avatar Sep 30 '24 15:09 Madraceee

This seems like something which has to be updated in "ingo" rather than here Can you help me with this?

Madraceee avatar Sep 30 '24 16:09 Madraceee

Yep, probably line 57 and following need adaption: https://github.com/schachmat/ingo/blob/master/in.go#L57

kordianbruck avatar Oct 06 '24 17:10 kordianbruck

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

shadow-absorber avatar Nov 18 '24 15:11 shadow-absorber