Esempio n. 1
0
FILE * xdgDataOpen(const char * relativePath, const char * mode, xdgHandle *handle)
{
	const char * const * dirs = xdgSearchableDataDirectories(handle);
	FILE * result = xdgFileOpen(relativePath, mode, dirs);
	if (!handle) xdgFreeStringList((char**)dirs);
	return result;
}
Esempio n. 2
0
char * xdgDataFind(const char * relativePath, xdgHandle *handle)
{
	const char * const * dirs = xdgSearchableDataDirectories(handle);
	char * result = xdgFindExisting(relativePath, dirs);
	if (!handle) xdgFreeStringList((char**)dirs);
	return result;
}
Esempio n. 3
0
int main(int argc, char* argv[])
{
	const char * const * item;
	xdgHandle handle;
	if (!xdgInitHandle(&handle)) return 1;
	printf("${XDG_DATA_HOME:-$HOME/.local/share}=%s\n", xdgDataHome(&handle));
	printf("${XDG_CONFIG_HOME:-$HOME/.config}=%s\n", xdgConfigHome(&handle));
	printf("${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
	for (item = xdgDataDirectories(&handle); *item; item++)
		printf("%s%c", *item, (item[1] ? ':' : '\n'));
	printf("${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}=");
	for (item = xdgSearchableDataDirectories(&handle); *item; item++)
		printf("%s%c", *item, (item[1] ? ':' : '\n'));
	printf("${XDG_CONFIG_DIRS:-/etc/xdg}=");
	for (item = xdgConfigDirectories(&handle); *item; item++)
		printf("%s%c", *item, (item[1] ? ':' : '\n'));
	printf("${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}=");
	for (item = xdgSearchableConfigDirectories(&handle); *item; item++)
		printf("%s%c", *item, (item[1] ? ':' : '\n'));
	printf("${XDG_CACHE_HOME:-$HOME/.cache}=%s\n", xdgCacheHome(&handle));
	xdgWipeHandle(&handle);
	return 0;
}
Esempio n. 4
0
FILE * xdgDataOpen(const char * relativePath, const char * mode, xdgHandle *handle)
{
	return xdgFileOpen(relativePath, mode, xdgSearchableDataDirectories(handle));
}
Esempio n. 5
0
char * xdgDataFind(const char * relativePath, xdgHandle *handle)
{
	return xdgFindExisting(relativePath, xdgSearchableDataDirectories(handle));
}