-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better integration with xdg dirs. #10838
Conversation
It's |
f66ff9e
to
fe31c8b
Compare
Came here to make an issue about Can you also make it so the existing |
Not impossible of course, but that strikes me as unnecessary. The hypothetical move should only happen on certain platforms and should only happen once. I think it's better for the user to just move the directory themselves instead of trying to code this. |
Fair enough. Thought it was worth asking. |
I reworked the last commit so it instead adds two new options: |
08cf800
to
6c2213e
Compare
I've rewritten the implementation, and this approach now has a few differences.
Doesn't really matter to users, but internally the path selection api now takes into account these potential global paths ( Seems to work just fine for me (linux) but more testing would be appreciated. Especially on macOS. |
2d929fc
to
826c410
Compare
f2d8661
to
1c02ff6
Compare
c7d78c9
to
59ac119
Compare
macOS really has completely different path conventions that mpv doesn't take into account and it treats it just like any other old unix-like system. This means mpv enforces certain conventions on it (like all the XDG stuff) that doesn't really apply. Since we'd like to use more of this but at the same time not distrupt mac users even more, let's just copy and paste the current code to a new file, update the build and call it a day. This way, the paths of these two platforms can more freely diverge.
Currently, nothing new is actually implemented but the idea is simply to just pass a type string all the way up from mp_find_user_file down to actually getting the platform path. This allows for selecting different directories besides the user's native config directory. See the next commit for an implementation.
A pain point for some users is the fact that watch_later is stored in the ~/.config directory when it's really not configuration data. Roughly 2 years ago, XDG_STATE_DIR was added to the XDG Base Directory Specification[0] and its description, user-specific state data, actually perfectly matches what watch_later data is for. Let's go ahead and use this directory as the default for watch_later. This change only affects non-darwin unix-like systems (i.e. Linux, BSDs, etc.). The directory doesn't move for anyone else. Internally, quite a few things change with regards to the path selection. If the platform in question does not have a statedir concept, then the path selection will simply return "home" instead (old behavior). Fixes mpv-player#9147. [0]: https://gitlab.freedesktop.org/xdg/xdg-specs/-/commit/4f2884e16db35f2962d9b64312917c81be5cb54b
I realized my previous approach was flawed with regards to runtime changes of the directories, so I rewrote it yet again. This time, the |
643cc21
to
5d261e8
Compare
This adds cache as a possible path for mpv to internally pick (~/.cache/mpv for non-darwin unix-like systems, the usual config directory for everyone else). For gpu shader cache and icc cache, controlling whether or not to write such files is done with the new --gpu-shader-cache and --icc-cache options respectively. Additionally, --cache-on-disk no longer requires explicitly setting the --cache-dir option. The old options, --cache-dir, --gpu-shader-cache-dir, and --icc-cache-dir simply set an override for the directory to save cache files. If unset, then the cache is saved in XDG_CACHE_HOME.
Awesome! |
The new version of mpv changed the path of the watch_later folder to ~/.local/state/mpv/watch_later. See mpv-player/mpv#10838
mpv v0.36.0 uses ~/.cache/mpv[1] [2]: Relates to netblue30#2838 netblue30#5936. [1] https://github.com/mpv-player/mpv/releases/tag/v0.36.0 [2] mpv-player/mpv#10838
Fixes #9147 and also supercedes #8184.
This basically does four things here.
path-darwin.c
).watch_later
directory toXDG_STATE_DIR
(no change for the stuff that doesn't usepath-unix.c
).XDG_CACHE_DIR
and it's used by default if applicable options aren't explicitly set (--cache-dir
,--icc-cache-dir
, and--gpu-shader-cache-dir
).On non-linux/bsd OSes, this means cache would start being saved by default in the default config dir so it's a little more invasive than the other changes.For the icc and gpu shaders, cache being saved or not is now controlled with the--icc-cache
and--gpu-shader-cache
options.