Functions | |
GWENHYWFAR_API int | GWEN_Directory_Close (GWEN_DIRECTORYDATA *d) |
GWENHYWFAR_API int | GWEN_Directory_Create (const char *path) |
GWENHYWFAR_API int | GWEN_Directory_CreatePublic (const char *path) |
GWENHYWFAR_API int | GWEN_Directory_FindFileInPaths (const GWEN_STRINGLIST *paths, const char *filePath, GWEN_BUFFER *fbuf) |
GWENHYWFAR_API int | GWEN_Directory_FindPathForFile (const GWEN_STRINGLIST *paths, const char *filePath, GWEN_BUFFER *fbuf) |
GWENHYWFAR_API void | GWEN_Directory_free (GWEN_DIRECTORYDATA *d) |
GWENHYWFAR_API int | GWEN_Directory_GetHomeDirectory (char *buffer, unsigned int size) |
GWENHYWFAR_API int | GWEN_Directory_GetPath (const char *path, unsigned int flags) |
GWENHYWFAR_API int | GWEN_Directory_GetTmpDirectory (char *buffer, unsigned int size) |
GWENHYWFAR_API GWEN_DIRECTORYDATA * | GWEN_Directory_new () |
GWENHYWFAR_API int | GWEN_Directory_Open (GWEN_DIRECTORYDATA *d, const char *n) |
GWENHYWFAR_API int | GWEN_Directory_OsifyPath (const char *path, GWEN_BUFFER *pbuf, int transformDriveElement) |
GWENHYWFAR_API int | GWEN_Directory_Read (GWEN_DIRECTORYDATA *d, char *buffer, unsigned int len) |
GWENHYWFAR_API int | GWEN_Directory_Rewind (GWEN_DIRECTORYDATA *d) |
GWENHYWFAR_API int GWEN_Directory_Close | ( | GWEN_DIRECTORYDATA * | d | ) |
Closes a previously opened directory.
d | pointer to a directory data structure. This should be created by calling GWEN_Directory_new(). |
GWENHYWFAR_API int GWEN_Directory_Create | ( | const char * | path | ) |
Creates a directory.
GWENHYWFAR_API int GWEN_Directory_CreatePublic | ( | const char * | path | ) |
Creates a public directory (a folder which can be listed and entered by anyone)
GWENHYWFAR_API int GWEN_Directory_FindFileInPaths | ( | const GWEN_STRINGLIST * | paths, | |
const char * | filePath, | |||
GWEN_BUFFER * | fbuf | |||
) |
GWENHYWFAR_API int GWEN_Directory_FindPathForFile | ( | const GWEN_STRINGLIST * | paths, | |
const char * | filePath, | |||
GWEN_BUFFER * | fbuf | |||
) |
GWENHYWFAR_API void GWEN_Directory_free | ( | GWEN_DIRECTORYDATA * | d | ) |
Destructor
GWENHYWFAR_API int GWEN_Directory_GetHomeDirectory | ( | char * | buffer, | |
unsigned int | size | |||
) |
Gets the current user's home directory and copies it into the given buffer.
On Unix, this looks up the passwd entry of the current user, similar to glib's g_get_home_dir(). Watch out: The environment variable "HOME" is *not* used, not even as a fallback if there is no passwd entry (different from g_get_home_dir()).
On Windows, this looks up the environment variable "HOME", then "USERPROFILE", then the Windows system directory. This behaviour is identical to glib's g_get_home_dir(). Watch out: In the normal non-mingw/msys environment, only "USERPROFILE" is set, e.g. to "c:\Documents\Yourusername". But if this function is called from within msys, then msys itself has set "HOME" to a different value, e.g. to "c:\msys\1.0\home\yourusername". In effect, your program will see a different home directory when run from within msys compared to without msys. This is weird, but it is identical to the glib behaviour and hence we leave it at that.
GWENHYWFAR_API int GWEN_Directory_GetPath | ( | const char * | path, | |
unsigned int | flags | |||
) |
Gets a file path. It uses Paths to either create or check for the existence of a given path.
path | path to inspect | |
flags | flags, please see GWEN_PATH_FLAGS_PATHMUSTEXIST et. al. |
GWENHYWFAR_API int GWEN_Directory_GetTmpDirectory | ( | char * | buffer, | |
unsigned int | size | |||
) |
Gets the directory to use for temporary files and copies it into the given buffer.
This is found from inspecting the environment variables TMPDIR, TMP, and TEMP in that order. If none of those are defined, "/tmp" is returned on UNIX and "C:\" on Windows. This is similar to glib's g_get_tmp_dir().
GWENHYWFAR_API GWEN_DIRECTORYDATA* GWEN_Directory_new | ( | ) |
Constructor.
GWENHYWFAR_API int GWEN_Directory_Open | ( | GWEN_DIRECTORYDATA * | d, | |
const char * | n | |||
) |
Opens a directory. This allows calling "Directory_Read" to succeed.
d | pointer to a directory data structure. This should be created by calling GWEN_Directory_new(). | |
n | path and name of the directory to open |
GWENHYWFAR_API int GWEN_Directory_OsifyPath | ( | const char * | path, | |
GWEN_BUFFER * | pbuf, | |||
int | transformDriveElement | |||
) |
Takes a path and translates it into a path that the running platform can understand. This is needed for unix paths used on Windows. If transformDriveElement is !=0 on Windows platforms and the first element of the path is "/x" (with x being [a..z,A..Z]) then this element is translated into the corresponding drive letter sequence (x:). Slashes and backslashes are transformed as needed by the running platform. Duplicate slashes/backslashed are removed.
path | path to translate | |
pbuf | buffer to which the path is appended | |
transformDriveElemen | see above (ignored on non-win32 platforms) |
GWENHYWFAR_API int GWEN_Directory_Read | ( | GWEN_DIRECTORYDATA * | d, | |
char * | buffer, | |||
unsigned int | len | |||
) |
Reads the next entry from a directory and stores the name of that entry in the given buffer. The entry returned is relative to the open directory.
d | pointer to a directory data structure. This should be created by calling GWEN_Directory_new(). | |
buffer | pointer to a buffer to receive the name | |
len | size of the buffer |
GWENHYWFAR_API int GWEN_Directory_Rewind | ( | GWEN_DIRECTORYDATA * | d | ) |
Rewinds the internal pointers, so that the next call to
d | pointer to a directory data structure. This should be created by calling GWEN_Directory_new(). |