Example #1
0
const char * xdgCacheHome(xdgHandle *handle)
{
	if (handle)
		return xdgGetCache(handle)->cacheHome;
	else
		return xdgGetRelativeHome("XDG_CACHE_HOME", DefaultRelativeCacheHome, sizeof(DefaultRelativeCacheHome)-1);
}
Example #2
0
const char * xdgDataHome(xdgHandle *handle)
{
	if (handle)
		return xdgGetCache(handle)->dataHome;
	else
		return xdgGetRelativeHome("XDG_DATA_HOME", DefaultRelativeDataHome, sizeof(DefaultRelativeDataHome)-1);
}
Example #3
0
const char * xdgConfigHome(xdgHandle *handle)
{
	if (handle)
		return xdgGetCache(handle)->configHome;
	else
		return xdgGetRelativeHome("XDG_CONFIG_HOME", DefaultRelativeConfigHome, sizeof(DefaultRelativeConfigHome)-1);
}
Example #4
0
int xdgUpdateData(xdgHandle *handle)
{
	xdgCachedData* cache = (xdgCachedData*)malloc(sizeof(xdgCachedData));
	xdgCachedData* oldCache;
	if (!cache) return FALSE;
	xdgZeroMemory(cache, sizeof(xdgCachedData));

	if (xdgUpdateHomeDirectories(cache) &&
		xdgUpdateDirectoryLists(cache))
	{
		/* Update successful, replace pointer to old cache with pointer to new cache */
		oldCache = xdgGetCache(handle);
		handle->reserved = cache;
		if (oldCache)
		{
			xdgFreeData(oldCache);
			free(oldCache);
		}
		return TRUE;
	}
	else
	{
		/* Update failed, discard new cache and leave old cache unmodified */
		xdgFreeData(cache);
		free(cache);
		return FALSE;
	}
}
Example #5
0
const char * xdgRuntimeDirectory(xdgHandle *handle)
{
	if (handle)
		return xdgGetCache(handle)->runtimeDirectory;
	else
		return xdgEnvDup("XDG_RUNTIME_DIRECTORY");
}
Example #6
0
void xdgWipeHandle(xdgHandle *handle)
{
	xdgCachedData* cache = xdgGetCache(handle);
	xdgFreeData(cache);
	free(cache);
}
Example #7
0
const char * xdgCacheHome(xdgHandle *handle)
{
	return xdgGetCache(handle)->cacheHome;
}
Example #8
0
const char * xdgDataHome(xdgHandle *handle)
{
	return xdgGetCache(handle)->dataHome;
}