|
| void | fs_listdir (const char *dir, FS_LISTDIR_CALLBACK cb, int type, void *user) |
| |
| void | fs_listdir_fileinfo (const char *dir, FS_LISTDIR_CALLBACK_FILEINFO cb, int type, void *user) |
| |
| int | fs_makedir (const char *path) |
| |
| int | fs_removedir (const char *path) |
| |
| int | fs_makedir_rec_for (const char *path) |
| |
| int | fs_storage_path (const char *appname, char *path, int max) |
| |
| int | fs_is_file (const char *path) |
| |
| int | fs_is_dir (const char *path) |
| |
| int | fs_is_relative_path (const char *path) |
| |
| int | fs_chdir (const char *path) |
| |
| char * | fs_getcwd (char *buffer, int buffer_size) |
| |
| const char * | fs_filename (const char *path) |
| |
| void | fs_split_file_extension (const char *filename, char *name, size_t name_size, char *extension=nullptr, size_t extension_size=0) |
| |
| void | fs_normalize_path (char *path) |
| |
| int | fs_parent_dir (char *path) |
| |
| int | fs_remove (const char *filename) |
| |
| int | fs_rename (const char *oldname, const char *newname) |
| |
| int | fs_file_time (const char *name, time_t *created, time_t *modified) |
| |
Utilities for accessing the file system.
◆ fs_chdir()
Changes the current working directory.
- Parameters
-
| path | New working directory path. |
- Returns
0 on success. 1 on failure.
◆ fs_file_time()
Gets the creation and the last modification date of a file or directory.
- Parameters
-
| name | Path of a file or directory. |
| created | Pointer where the creation time will be stored. |
| modified | Pointer where the modification time will be stored. |
- Returns
0 on success. non-zero on failure.
◆ fs_filename()
Gets the name of a file or folder specified by a path, i.e. the last segment of the path.
- Parameters
-
| path | Path from which to retrieve the filename. |
- Returns
- Filename of the path.
◆ fs_getcwd()
Gets the current working directory.
- Parameters
-
| buffer | Buffer that will receive the current working directory. |
| buffer_size | Size of the buffer. |
- Returns
- Pointer to the buffer on success,
nullptr on failure.
◆ fs_is_dir()
Checks if a folder exists.
- Parameters
-
- Returns
1 if a folder with the given path exists.
-
0 on failure or if the folder does not exist.
◆ fs_is_file()
Checks if a file exists.
- Parameters
-
- Returns
1 if a file with the given path exists.
-
0 on failure or if the file does not exist.
◆ fs_is_relative_path()
Checks whether a given path is relative or absolute.
- Parameters
-
- Returns
1 if relative, 0 if absolute.
◆ fs_listdir()
Lists the files and folders in a directory.
- Parameters
-
| dir | Directory to list. |
| cb | Callback function to call for each entry. |
| type | Type of the directory. |
| user | Pointer to give to the callback. |
◆ fs_listdir_fileinfo()
Lists the files and folders in a directory and gets additional file information.
- Parameters
-
| dir | Directory to list. |
| cb | Callback function to call for each entry. |
| type | Type of the directory. |
| user | Pointer to give to the callback. |
◆ fs_makedir()
Creates a directory.
- Parameters
-
- Returns
0 on success. Negative value on failure.
◆ fs_makedir_rec_for()
Recursively creates parent directories for a file or directory.
- Parameters
-
| path | File or directory for which to create parent directories. |
- Returns
0 on success. Negative value on failure.
◆ fs_normalize_path()
Normalizes the given path: replaces backslashes with regular slashes and removes trailing slashes.
- Parameters
-
◆ fs_parent_dir()
Get the parent directory of a directory.
- Parameters
-
| path | Path of the directory. The parent will be store in this buffer as well. |
- Returns
0 on success. 1 on failure.
◆ fs_remove()
Deletes a file.
- Parameters
-
| filename | Path of the file to delete. |
- Returns
0 on success. 1 on failure.
◆ fs_removedir()
Removes a directory.
- Parameters
-
- Returns
0 on success. Negative value on failure.
◆ fs_rename()
Renames the file or directory. If the paths differ the file will be moved.
- Parameters
-
| oldname | The current path of a file or directory. |
| newname | The new path for the file or directory. |
- Returns
0 on success. 1 on failure.
◆ fs_split_file_extension()
Splits a filename into name (without extension) and file extension.
- Parameters
-
| filename | The filename to split. |
| name | Buffer that will receive the name without extension, may be nullptr. |
| name_size | Size of the name buffer (ignored if name is nullptr). |
| extension | Buffer that will receive the extension, may be nullptr. |
| extension_size | Size of the extension buffer (ignored if extension is nullptr). |
◆ fs_storage_path()
Fetches per user configuration directory.
- Parameters
-
| appname | Name of the application. |
| path | Buffer that will receive the storage path. |
| max | Size of the buffer. |
- Returns
0 on success. Negative value on failure.