include/basedir_fs.h File Reference

#include <basedir.h>
#include <stdio.h>
#include <sys/types.h>

Go to the source code of this file.

Functions

Filesystem-related XDG Base Directory Queries


char * xdgDataFind (const char *relativePath, xdgHandle *handle)
char * xdgConfigFind (const char *relativePath, xdgHandle *handle)
FILE * xdgDataOpen (const char *relativePath, const char *mode, xdgHandle *handle)
FILE * xdgConfigOpen (const char *relativePath, const char *mode, xdgHandle *handle)
int xdgMakePath (const char *path, mode_t mode)


Detailed Description

Filesystem functions related to the XDG Base Directory specification.

Function Documentation

char* xdgConfigFind ( const char *  relativePath,
xdgHandle handle 
)

Find all existing config files corresponding to relativePath. Consider as performing

 fopen(filename, "r") 
on every possible filename and returning the successful filenames.
Parameters:
relativePath Path to scan for.
handle Handle to data cache, initialized with xdgInitHandle().
Returns:
A sequence of null-terminated strings terminated by a double-null (empty string) and allocated using malloc(), e.g.:
 "/etc/xdg\0/home/jdoe/.config\0" 

FILE* xdgConfigOpen ( const char *  relativePath,
const char *  mode,
xdgHandle handle 
)

Open first possible config file corresponding to relativePath. Consider as performing

 fopen(filename, mode) 
on every possible filename and returning the first successful filename or NULL.
Parameters:
relativePath Path to scan for.
mode Mode with which to attempt to open files (see fopen modes).
handle Handle to data cache, initialized with xdgInitHandle().
Returns:
File pointer if successful else NULL. Client must use fclose to close file.

char* xdgDataFind ( const char *  relativePath,
xdgHandle handle 
)

Find all existing data files corresponding to relativePath. Consider as performing

 fopen(filename, "r") 
on every possible filename and returning the successful filenames.
Parameters:
relativePath Path to scan for.
handle Handle to data cache, initialized with xdgInitHandle().
Returns:
A sequence of null-terminated strings terminated by a double-null (empty string) and allocated using malloc(), e.g.:
 "/etc/share\0/home/jdoe/.local\0" 

FILE* xdgDataOpen ( const char *  relativePath,
const char *  mode,
xdgHandle handle 
)

Open first possible data file corresponding to relativePath. Consider as performing

 fopen(filename, mode) 
on every possible filename and returning the first successful filename or NULL.
Parameters:
relativePath Path to scan for.
mode Mode with which to attempt to open files (see fopen modes).
handle Handle to data cache, initialized with xdgInitHandle().
Returns:
File pointer if successful else NULL. Client must use fclose to close file.

int xdgMakePath ( const char *  path,
mode_t  mode 
)

Create path by recursively creating directories. This utility function is not part of the XDG specification, but nevertheless useful in context of directory manipulation.

Parameters:
path The path to be created.
mode The permissions to use for created directories. This parameter is modified by the process's umask. For details, see mkdir(2)'s mode parameter.
Returns:
Zero on success, -1 if an error occured (in which case errno will be set appropriately)


Generated on Fri May 15 09:57:59 2009 for XDGBaseDirectorySpecificationsLibrary by  doxygen 1.5.8