RasmusLindroth / tut

TUI for Mastodon with vim inspired keys
https://tut.anv.nu
MIT License
446 stars 29 forks source link

os#UserConfigDir does not respect XDG_CONFIG_HOME on Macos #236

Closed merikan closed 1 year ago

merikan commented 1 year ago

Thanks for a great project

When using tut on Macos the variable XDG_CONFIG_HOME is not respected by Go and it always returns $HOME/Library/Application Support/tut which is not what you might expect in the terminal. The package github.com/adrg/xdg translates XDG variables in a way that you would expect.

I understand that this type of change isn't backward compatible so a small note about it in the documentation could be enough

ryspace commented 1 year ago

If you open up a terminal and run echo $XDG_CONFIG_HOME, what is returned?

merikan commented 1 year ago

Hi

I get the expected output /Users/peter/.config. I am using XDG for most of my tools in my terminal, so it's not a xdg problem.

If one looks at the implementation of os#UserConfigDir it only uses XDG_ for the Unix os and it also says so in the godoc, but it is easy to miss.

There is an issue where they discuss this and they chose not to change anything since it would be a breaking change. Sadly, no warning text was written, so unfortunately it is used and the meaning is misinterpreted.

RasmusLindroth commented 1 year ago

To not make it a breaking change I've fixed it so it will look is tut exists in os.UserConfigDir and if it does it will use that location. But if you move that folder to XDG_CONFIG_HOME it will use that path instead.

I'll include it in the next release :)

RasmusLindroth commented 1 year ago

It's now released. Please check if it works as intended, if it doesn't reopen this issue :)

merikan commented 1 year ago

Can confirm that it works as expected. Awesome!!