dirs-dev / dirs-rs

a low-level library that provides config/cache/data paths, following the respective conventions on Linux, macOS and Windows

Home Page:https://dirs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use XDG_STATE_HOME as data_local_dir

chayleaf opened this issue · comments

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.

To me, this seems to indicate that non-portable files should be stored here. Of course, changing this would be a breaking change.

commented

I think this would be rather surprising for users – which issue would such a behavior address?

XDG_DATA_HOME is often synced between machines by the user. XDG_STATE_HOME is not to be synced, as it's for local application state. When XDG_DATA_HOME is used, the expectation for data_local_dir's contents to not be synced is broken. Additionally, the "state_dir" that's only supported on Linux is a weird outlier (in that storing local state makes sense on Windows and Mac, unlike runtime_dir/executable_dir) and is as such unlikely to be used by devs for cross-platform apps. IMO it makes much more sense to merge state_dir and data_local_dir, since they both share roughly the same purpose (storing machine-specific files).