< index
< 3. System layer
|
=====================================
3.4 Filesystem utilities
=====================================
|
|
TCODSystem::createDirectory
Those are a few function that cannot be easily implemented in a portable way in C/C++. They have no python wrapper since python provides its own builtin functions.
All those functions return false if an error occured.
The first one creates a new directory.
C++ : static bool TCODSystem::createDirectory(const char *path)
C : bool TCOD_sys_create_directory(const char *path)
Parameter | Description |
path | Directory path. The immediate father directory (<path>/..) must exist and be writable. |
TCODSystem::deleteDirectory
This one destroys a directory.
C++ : static bool TCODSystem::deleteDirectory(const char *path)
C : bool TCOD_sys_delete_directory(const char *path)
Parameter | Description |
path | Directory path. This directory must exist, be writable and empty. |
TCODSystem::deleteFile
This one destroys a file.
C++ : static bool TCODSystem::deleteFile(const char *path)
C : bool TCOD_sys_delete_file(const char *path)
Parameter | Description |
path | File path. This file must exist and be writable. |
TCODSystem::isDirectory
To check if a path is a directory.
C++ : static bool TCODSystem::isDirectory(const char *path)
C : bool TCOD_sys_is_directory(const char *path)
Parameter | Description |
path | A path to check. |
TCODSystem::getDirectoryContent
To get the list of entries in a directory (including sub-directories, except . and ..).
The returned list is allocated by the function and must be deleted by you. All the const char * inside must be also freed with TCODList::clearAndDelete.
C++ : static TCODList TCODSystem::getDirectoryContent(const char *path, const char *pattern)
C : TCOD_list_t TCOD_sys_get_directory_content(const char *path)
Parameter | Description |
path | A directory. |
pattern | If NULL or empty, returns all directory entries. Else returns only entries matching the pattern. The pattern is NOT a regular expression. It can only handle one '*' wildcard. Examples : *.png, saveGame*, font*.png |