-
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
Support XDG base directory specification #109
Comments
It's overcomplicated and doesn't really make anything better. You can get the same effect with setting the environment variable Rejected. |
It is just 3 vars with defaults. I think this is good explanation why xdg is useful: mpv already has cache-like dir ~/.mpv/watch_later/.
|
htop isn't conform to this XDG spec. For instance, it ignores XDG_CONFIG_DIRS. If I support just XDG_CONFIG_HOME, people will without doubt come and whine that XDG_CONFIG_DIRS is not supported and demand that it is implemented. So I'd rather just go with the simpler choice and use the classic convention. While storing config files under ~/.config is a quite simple idea, XDG goes further and turns everything into bloat as usual.
Why is turning ~/.config into a trash can instead better? |
Most likely nobody will ever notice even if you just change ~/.mpv/ to ~/.config/mpv/ without respecting $XDG_CONFIG_HOME.
Because it is in right place and hidden. |
That's not mpv's problem, now, is it? |
changing ~/.mpv/ to ~/.config/mpv/ would break people's current custom keybindings |
Not supporting standards is mpv problem. If it possible to make user experience better, why not do?
When VLC migrated to XDG paths, it automatically moved all configs to new locations. All settings were kept. |
Please don't assume that. There's almost no app out there that actually uses $XDG_CONFIG_DIRS. It's only useful if you want flexible system-wide settings. |
OK, maybe we'll consider implementing half of the spec. Or to be precise, implement the $XDG_CONFIG_HOME part only, which is indeed relatively simple. It's usually not a good idea to implement standards only partially, but in this case it might be justified: most things on Linux don't implement it fully, and most people do not need the "extended" part of the basedir spec at all. So I'd implement it like this (pseudo-code):
Opinions? |
Looks good (don't forget to check if $XDG_CONFIG_HOME is not defined, in which case you use $HOME/.config). I'd take the deprecation a step further and actually move the config files to $xch/mpv and print("note: your files have been migrated to..."). Since mpv is a relatively recent project, you should be ok with that for a release or two. |
I have to run off for the night, but thank you for considering this! I know it doesn't seem like it but it's important to some people ;) |
Yeah, $XDG_CONFIG_HOME is not defined on OSX but ~/.config/ exists for me since various other tools created it and just put their stuff there anyway. So I would suggest to check if ~/.config/ exists if $XDG_CONFIG_HOME isn't set and then just go with that. |
Yes, XDG_CONFIG_HOME isn't always set on Linux either, I just didn't bother including that in the pseudo-code. Anyway... you're saying it should use ~/.config on OSX too? |
Yes please. |
I'll try and implement this; will also try and use external libraries to do the heavy lifting because implementing everything in mpv itself looks like too much effort. Also, the spec does say that if |
In that case, don't waste your time.
It shouldn't be much effort. It's literally just about concatenating an environment variable with a string. No thanks, I don't want the useless extra complexity of full xdg-basedir support. |
If it's too much effort then you're looking at supporting way too much. Just check the env variable and fall back to ~/.config. As for windows, you can safely keep the old behaviour on there; basedir is not recommended for windows. |
That's the wrong behavior though.
Considering its maintainers, it's not recommended for anything not-linux. However, putting the config file in a folder in the CWD is also wrong; there are specific system paths made for this. |
No, it's not. You're confusing "wrong" and "incomplete". Implementing a part of the xdg spec is not only possible, it's the recommended behaviour for standalone applications (as they rarely need the flexibility that the system-wide variables offer). I work with xdg specs a lot and I'm a big evangelist of basedir but I've never recommended anyone to implement the full spec.
Not sure where you got CWD from. %APPDATA% is the standard place for it on Windows. And the basedir spec is used by plenty of Linux->OSX ports so it's not necessarily a bad idea to use it there, but it would be more standard to use ~/Library/Preferences afaik. |
On OSX, we normally use the Linux convention, or if the OSX bundle is used, a native OSX API for the config path. On Windows, some users want to start mpv out of a single directory, which means the config file will be next to mpv.exe, instead of in a system defined config dir. |
The situation on Windows seems pretty straightforward to me if the exe directory is treated the same as the bundle directory on OSX. If I understand path.c correctly, it checks the user config path, an optional bundle path and then the system config path. If the user config path is I'm not sure if it should try reading |
It's on a separate branch for now; if that implementation is OK I'll merge to master and close the bug. It now ignores |
Yay for forgotten debug code :D |
Updated in response to @wm4's comments. |
Only uses XDG_CONFIG_HOME and XDG_CACHE_HOME. Appropriate, equivalent(ish) behavior is implemented for Windows. Cygwin is treated as not-windows. The watch_later functionality now stores its files in the cache dir. Still supports the ~/.mpv path if it exists, but warns about the change to the new one. That codepath is toggleable by the SUPPORT_OLD_CONFIG internal define, in case it's ever wanted. Note that it is ignored if it's a symlink, to allow symlinking to the new path to support older versions. On Windows, the config files are now stored on %AppData%\mpv, unless there is an "mpv" dir in the same folder as the mpv.exe. Cache files always go on %LocalAppData%\mpv, but it's possible to make it put the files in the exe-local "mpv" dir by changing the ALWAYS_LOCAL_APPDATA define to 0.
What's the status on this? will it be merged in? |
Ask @Kovensky. |
Empirically, Kovensky has no interest in finishing this, so this is a WONTFIX. |
That's annoying. I don't see the benefit in closing this though, it's still a valid request :/ |
Well ok... Still needs someone to implement this, though. |
Obsoleted. |
Please add support for XDG base directory specification.
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
The text was updated successfully, but these errors were encountered: