From: TimePath Date: Sat, 6 Dec 2014 05:51:06 +0000 (+1100) Subject: Use ~/.config on linux for root directory if legacy path not found X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35d1b1db6bac3ff5450e1f8b5f1d1008fdc5be73;p=xonotic%2Fdarkplaces.git Use ~/.config on linux for root directory if legacy path not found --- diff --git a/fs.c b/fs.c index 994155aa..00a4aa31 100644 --- a/fs.c +++ b/fs.c @@ -1847,7 +1847,19 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use homedir = getenv("HOME"); if(homedir) { +#ifdef MACOSX dpsnprintf(userdir, userdirsize, "%s/.%s/", homedir, gameuserdirname); +#else + // Legacy ~/.userdir location + if(access(va(vabuf, sizeof(vabuf), "%s/.%s/", homedir, gameuserdirname), W_OK | X_OK) >= 0) + { + dpsnprintf(userdir, userdirsize, "%s/.%s/", homedir, gameuserdirname); + break; + } + // XDG_CONFIG_HOME + strlcat(homedir, "/.config", sizeof(homedir)); + dpsnprintf(userdir, userdirsize, "%s/.config/%s/", homedir, gameuserdirname); +#endif break; } return -1;