Functions | |
GWENHYWFAR_API int | GWEN_Directory_Close (GWEN_DIRECTORY *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_DIRECTORY *d) |
GWENHYWFAR_API int | GWEN_Directory_GetAllEntries (char *folder, GWEN_STRINGLIST *sl, const char *mask) |
GWENHYWFAR_API int | GWEN_Directory_GetDirEntries (char *folder, GWEN_STRINGLIST *sl, const char *mask) |
GWENHYWFAR_API int | GWEN_Directory_GetFileEntries (char *folder, GWEN_STRINGLIST *sl, const char *mask) |
GWENHYWFAR_API int | GWEN_Directory_GetFileEntriesWithType (char *folder, GWEN_STRINGLIST *sl, const char *mask) |
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_GetPrefixDirectory (char *buffer, unsigned int size) |
GWENHYWFAR_API int | GWEN_Directory_GetTmpDirectory (char *buffer, unsigned int size) |
GWENHYWFAR_API GWEN_DIRECTORY * | GWEN_Directory_new () |
GWENHYWFAR_API int | GWEN_Directory_Open (GWEN_DIRECTORY *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_DIRECTORY *d, char *buffer, unsigned int len) |
GWENHYWFAR_API int | GWEN_Directory_Rewind (GWEN_DIRECTORY *d) |
GWENHYWFAR_API int GWEN_Directory_Close | ( | GWEN_DIRECTORY * | d | ) |
Closes a previously opened directory.
d | pointer to a directory data structure. This should be created by calling GWEN_Directory_new(). |
Referenced by check_directory(), GWEN_Directory_GetAllEntries(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), and GWEN_LoadPluginDescrsByType().
GWENHYWFAR_API int GWEN_Directory_Create | ( | const char * | path | ) |
Creates a directory.
Referenced by GWEN_Directory_HandlePathElement().
GWENHYWFAR_API int GWEN_Directory_CreatePublic | ( | const char * | path | ) |
Creates a public directory (a folder which can be listed and entered by anyone)
Referenced by GWEN_Directory_HandlePathElement().
GWENHYWFAR_API int GWEN_Directory_FindFileInPaths | ( | const GWEN_STRINGLIST * | paths, | |
const char * | filePath, | |||
GWEN_BUFFER * | fbuf | |||
) |
Definition at line 285 of file directory_all.c.
References DBG_DEBUG, DBG_INFO, DIRSEP, GWEN_Buffer_AppendBuffer(), GWEN_Buffer_AppendString(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_ERROR_NOT_FOUND, GWEN_LOGDOMAIN, GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), and GWEN_StringListEntry_Next().
Referenced by GWEN_Io_LayerTls_Prepare().
GWENHYWFAR_API int GWEN_Directory_FindPathForFile | ( | const GWEN_STRINGLIST * | paths, | |
const char * | filePath, | |||
GWEN_BUFFER * | fbuf | |||
) |
Definition at line 323 of file directory_all.c.
References DBG_DEBUG, DBG_INFO, DIRSEP, GWEN_Buffer_AppendString(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_ERROR_NOT_FOUND, GWEN_LOGDOMAIN, GWEN_StringList_FirstEntry(), GWEN_StringListEntry_Data(), and GWEN_StringListEntry_Next().
GWENHYWFAR_API void GWEN_Directory_free | ( | GWEN_DIRECTORY * | d | ) |
GWENHYWFAR_API int GWEN_Directory_GetAllEntries | ( | char * | folder, | |
GWEN_STRINGLIST * | sl, | |||
const char * | mask | |||
) |
This function reads all entries of the given folder and stores them in the given string list if they match a mask.
The entries added to the string list are the names returned by the operating systems. They do not contain the full path.
folder | folder to inspect | |
sl | string list to add new entries to | |
mask | if omitted, all entries match (wildcards and jokers allowed) |
Definition at line 388 of file directory_all.c.
References DBG_INFO, GWEN_Directory_Close(), GWEN_Directory_free(), GWEN_Directory_new(), GWEN_Directory_Open(), GWEN_Directory_Read(), GWEN_LOGDOMAIN, GWEN_StringList_AppendString(), GWEN_Text_ComparePattern(), and NULL.
GWENHYWFAR_API int GWEN_Directory_GetDirEntries | ( | char * | folder, | |
GWEN_STRINGLIST * | sl, | |||
const char * | mask | |||
) |
This function does the same as GWEN_Directory_GetAllEntries, but it only adds folder entries.
folder | folder to inspect | |
sl | string list to add new entries to | |
mask | if omitted, all entries match (wildcards and jokers allowed) |
Definition at line 511 of file directory_all.c.
References DBG_INFO, GWEN_Buffer_AppendString(), GWEN_Buffer_Crop(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DIR_SEPARATOR_S, GWEN_Directory_Close(), GWEN_Directory_free(), GWEN_Directory_new(), GWEN_Directory_Open(), GWEN_Directory_Read(), GWEN_LOGDOMAIN, GWEN_StringList_AppendString(), GWEN_Text_ComparePattern(), and NULL.
GWENHYWFAR_API int GWEN_Directory_GetFileEntries | ( | char * | folder, | |
GWEN_STRINGLIST * | sl, | |||
const char * | mask | |||
) |
This function does the same as GWEN_Directory_GetAllEntries, but it only adds file entries.
folder | folder to inspect | |
sl | string list to add new entries to | |
mask | if omitted, all entries match (wildcards and jokers allowed) |
Definition at line 467 of file directory_all.c.
References DBG_INFO, GWEN_Buffer_AppendString(), GWEN_Buffer_Crop(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DIR_SEPARATOR_S, GWEN_Directory_Close(), GWEN_Directory_free(), GWEN_Directory_new(), GWEN_Directory_Open(), GWEN_Directory_Read(), GWEN_LOGDOMAIN, GWEN_StringList_AppendString(), GWEN_Text_ComparePattern(), and NULL.
GWENHYWFAR_API int GWEN_Directory_GetFileEntriesWithType | ( | char * | folder, | |
GWEN_STRINGLIST * | sl, | |||
const char * | mask | |||
) |
This function does the same as GWEN_Directory_GetAllEntries, but in addition a entry type indicator is prepended to the entries added to the string list. Known indicators are:
folder | folder to inspect | |
sl | string list to add new entries to | |
mask | if omitted, all entries match (wildcards and jokers allowed) |
Definition at line 417 of file directory_all.c.
References DBG_INFO, GWEN_Buffer_AppendString(), GWEN_Buffer_Crop(), GWEN_Buffer_GetPos(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DIR_SEPARATOR_S, GWEN_Directory_Close(), GWEN_Directory_free(), GWEN_Directory_new(), GWEN_Directory_Open(), GWEN_Directory_Read(), GWEN_LOGDOMAIN, GWEN_StringList_AppendString(), GWEN_Text_ComparePattern(), and NULL.
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.
Referenced by GWEN_PathManager_AddRelPath().
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. |
Definition at line 222 of file directory_all.c.
References DBG_INFO, GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_Directory_HandlePathElement(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_CHECKROOT, and GWEN_Path_Handle().
GWENHYWFAR_API int GWEN_Directory_GetPrefixDirectory | ( | char * | buffer, | |
unsigned int | size | |||
) |
Gets the prefix to which the calling executable was installed, e.g. if the executable was installed using prefix "/usr" then the binary itself will be in "/usr/bin". In this case this function will return the directory name "/usr". Please note that this function only looks at the folder at which the calling exectuable is located when this function is called, so if you move the binary to another place then the result will be different.
Referenced by GWEN_PathManager_AddRelPath().
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().
Definition at line 361 of file directory_all.c.
Referenced by check_directory().
GWENHYWFAR_API GWEN_DIRECTORY* GWEN_Directory_new | ( | ) |
GWENHYWFAR_API int GWEN_Directory_Open | ( | GWEN_DIRECTORY * | 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 |
Referenced by check_directory(), GWEN_Directory_GetAllEntries(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), and GWEN_LoadPluginDescrsByType().
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) |
Definition at line 243 of file directory_all.c.
References GWEN_Buffer_AppendByte().
Referenced by GWEN_PathManager_AddPath().
GWENHYWFAR_API int GWEN_Directory_Read | ( | GWEN_DIRECTORY * | 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 |
Referenced by GWEN_Directory_GetAllEntries(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), and GWEN_LoadPluginDescrsByType().
GWENHYWFAR_API int GWEN_Directory_Rewind | ( | GWEN_DIRECTORY * | 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(). |