aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fccfg.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-21 09:10:35 +0200
committermarha <marha@users.sourceforge.net>2012-05-21 09:10:35 +0200
commitf543ceaca6820260f15a4eff86938214cf43c7d2 (patch)
treed66901c0385bd008ba46600be695c500daa78c8f /fontconfig/src/fccfg.c
parent062c45ff0df6a52080dcd74433710d47127cbe29 (diff)
downloadvcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.tar.gz
vcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.tar.bz2
vcxsrv-f543ceaca6820260f15a4eff86938214cf43c7d2.zip
fontconfig mesa xkeyboard-config xserver pixman git update 21 Mar 2012
Diffstat (limited to 'fontconfig/src/fccfg.c')
-rw-r--r--fontconfig/src/fccfg.c78
1 files changed, 77 insertions, 1 deletions
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index 31c427636..5b7249201 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -1837,6 +1837,81 @@ FcConfigHome (void)
return 0;
}
+FcChar8 *
+FcConfigXdgCacheHome (void)
+{
+ const char *env = getenv ("XDG_CACHE_HOME");
+ FcChar8 *ret = NULL;
+
+ if (env)
+ ret = FcStrCopy ((const FcChar8 *)env);
+ else
+ {
+ const FcChar8 *home = FcConfigHome ();
+ size_t len = home ? strlen ((const char *)home) : 0;
+
+ ret = malloc (len + 7 + 1);
+ if (ret)
+ {
+ memcpy (ret, home, len);
+ memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
+ ret[len + 7] = 0;
+ }
+ }
+
+ return ret;
+}
+
+FcChar8 *
+FcConfigXdgConfigHome (void)
+{
+ const char *env = getenv ("XDG_CONFIG_HOME");
+ FcChar8 *ret = NULL;
+
+ if (env)
+ ret = FcStrCopy ((const FcChar8 *)env);
+ else
+ {
+ const FcChar8 *home = FcConfigHome ();
+ size_t len = home ? strlen ((const char *)home) : 0;
+
+ ret = malloc (len + 8 + 1);
+ if (ret)
+ {
+ memcpy (ret, home, len);
+ memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
+ ret[len + 8] = 0;
+ }
+ }
+
+ return ret;
+}
+
+FcChar8 *
+FcConfigXdgDataHome (void)
+{
+ const char *env = getenv ("XDG_DATA_HOME");
+ FcChar8 *ret = NULL;
+
+ if (env)
+ ret = FcStrCopy ((const FcChar8 *)env);
+ else
+ {
+ const FcChar8 *home = FcConfigHome ();
+ size_t len = home ? strlen ((const char *)home) : 0;
+
+ ret = malloc (len + 13 + 1);
+ if (ret)
+ {
+ memcpy (ret, home, len);
+ memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
+ ret[len + 13] = 0;
+ }
+ }
+
+ return ret;
+}
+
FcBool
FcConfigEnableHome (FcBool enable)
{
@@ -1883,7 +1958,7 @@ FcConfigFilename (const FcChar8 *url)
default:
path = FcConfigGetPath ();
if (!path)
- return 0;
+ return NULL;
for (p = path; *p; p++)
{
file = FcConfigFileExists (*p, url);
@@ -1893,6 +1968,7 @@ FcConfigFilename (const FcChar8 *url)
FcConfigFreePath (path);
break;
}
+
return file;
}