Skip to content

Conversation

@Ratakor
Copy link
Contributor

@Ratakor Ratakor commented Sep 23, 2024

No description provided.

@Ratakor
Copy link
Contributor Author

Ratakor commented Jul 21, 2025

Any update on that getting merged?

@Techatrix
Copy link
Member

What's the use case for the state folder? If it's for storing log files then renaming it to logs or similar would be reasonable. Otherwise the value $HOME/Library/Logs on macos for a state folder does not make sense.

@Ratakor
Copy link
Contributor Author

Ratakor commented Jul 24, 2025

What's the use case for the state folder? If it's for storing log files then renaming it to logs or similar would be reasonable. Otherwise the value $HOME/Library/Logs on macos for a state folder does not make sense.

As per the XDG Base Directory Specification:

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …)
  • current state of the application that can be reused on a restart (view, layout, open files, undo history, …)

It's not only related to logs, as an example it's also used to store swap files by neovim. Should I change the name nonetheless?

@Techatrix
Copy link
Member

I know that $XDG_STATE_HOME can be used for more than log files. This is not the issue. The issue is that requesting the state folder on macos will return $HOME/Library/Logs which is bad. What if the application wants to store swap files as you mentioned? Obviously that shouldn't be stored $HOME/Library/Logs.

If the folder name would be renamed to logs then the defaults on all platforms are reasonable and there is no longer an issue:

  • On windows, storing log files in %LOCALAPPDATA%\Temp is reasonable
  • On macos, storing log files in $HOME/Library/Logs is reasonable
  • On unix, storing log files in $XDG_STATE_HOME is reasonable

Otherwise, a better directory for macos needs to be found.

@Techatrix Techatrix merged commit ab5cf5f into ziglibs:master Jul 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants