From 269f0e743e5634691f0c9d5b1b8a4bb68eedbbd0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 25 Jun 2020 17:38:47 +0200 Subject: path: switch back to using non-XDG config dir by default XDG is stupid, so change back to the standard behavior. Unfortunately, most users will now have the XDG one, so we will still need to load this. (This is exactly the same problem as when XDG support was introduced, just the other way around). This should not affect any normal users. Hopefully I tested this well enough; my intention is not to torment miserable XDG fans; they can keep using their config dir if they want it. This changes behavior in two cases: - new users (now creates ~/.mpv/ instead of ~/.config/mpv/) - users which have both directories The latter case will behave subtly or obviously different, not sure. Just fix your shit. Extend the manpage with all the messy details, as far as I could reverse engineer them from the code. --- osdep/path-unix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'osdep/path-unix.c') diff --git a/osdep/path-unix.c b/osdep/path-unix.c index d9a49ab06d..4a79a1838e 100644 --- a/osdep/path-unix.c +++ b/osdep/path-unix.c @@ -33,17 +33,17 @@ static void path_init(void) char *home = getenv("HOME"); char *xdg_dir = getenv("XDG_CONFIG_HOME"); + if (home && home[0]) + snprintf(mpv_home, sizeof(mpv_home), "%s/.mpv", home); + + // Maintain compatibility with old XDG config dirs if (xdg_dir && xdg_dir[0]) { - snprintf(mpv_home, sizeof(mpv_home), "%s/mpv", xdg_dir); + snprintf(old_home, sizeof(old_home), "%s/mpv", xdg_dir); } else if (home && home[0]) { - snprintf(mpv_home, sizeof(mpv_home), "%s/.config/mpv", home); + snprintf(old_home, sizeof(old_home), "%s/.config/mpv", home); } - // Maintain compatibility with old ~/.mpv - if (home && home[0]) - snprintf(old_home, sizeof(old_home), "%s/.mpv", home); - - // If the old ~/.mpv exists, and the XDG config dir doesn't, use the old + // If the compat. dir exists, and the proper dir doesn't, use the compat. // config dir only. if (mp_path_exists(old_home) && !mp_path_exists(mpv_home)) { snprintf(mpv_home, sizeof(mpv_home), "%s", old_home); -- cgit v1.2.3