Mstdlib-1.24.0
|
void M_fs_dir_entry_destroy | ( | M_fs_dir_entry_t * | entry | ) |
Destroy a directory entry.
[in] | entry | The entry to destroy. |
M_fs_type_t M_fs_dir_entry_get_type | ( | const M_fs_dir_entry_t * | entry | ) |
Get the type of the entry.
[in] | entry | The entry. |
M_bool M_fs_dir_entry_get_ishidden | ( | const M_fs_dir_entry_t * | entry | ) |
Get whether this entry is considered hidden by the OS.
[in] | entry | The entry. |
const char * M_fs_dir_entry_get_name | ( | const M_fs_dir_entry_t * | entry | ) |
Get the filename of the entry.
The path/filename is relative to the directory that was walked.
[in] | entry | The entry. |
const char * M_fs_dir_entry_get_resolved_name | ( | const M_fs_dir_entry_t * | entry | ) |
Get the resolved filename.
This only applies if the entry is a symlink. The resolved name is the path that the symlink points to. This is relative to the filename.
[in] | entry | The entry. |
const M_fs_info_t * M_fs_dir_entry_get_info | ( | const M_fs_dir_entry_t * | entry | ) |
Get the file information about the entry.
This may be NULL if reading file info was not requested during walk.
[in] | entry | The entry. |
void M_fs_dir_entries_destroy | ( | M_fs_dir_entries_t * | d | ) |
Destroy a list of directory entries.
[in] | d | The entry list to destroy. |
void M_fs_dir_entries_sort | ( | M_fs_dir_entries_t * | d, |
M_fs_dir_sort_t | primary_sort, | ||
M_bool | primary_asc, | ||
M_fs_dir_sort_t | secondary_sort, | ||
M_bool | secondary_asc | ||
) |
Sort a list of directory entries.
This does an in place sort and does not keep list sorted for subsequent insertions.
[in] | d | The entry list. |
[in] | primary_sort | Primary sort method. |
[in] | primary_asc | Should the primary sorting be ascending. |
[in] | secondary_sort | The secondary sort method that should be used when entries are considered equal according to the primary_sort method. |
[in] | secondary_asc | Should the secondary sorting be ascending. |
size_t M_fs_dir_entries_len | ( | const M_fs_dir_entries_t * | d | ) |
Get the number of entries in the list.
[in] | d | The entry list. |
const M_fs_dir_entry_t * M_fs_dir_entries_at | ( | const M_fs_dir_entries_t * | d, |
size_t | idx | ||
) |
Get the entry at at the specified index.
The entry remains part of the list.
[in] | d | The entry list. |
[in] | idx | The index. |
M_fs_dir_entry_t * M_fs_dir_entries_take_at | ( | M_fs_dir_entries_t * | d, |
size_t | idx | ||
) |
Take the entry from the list.
The entry will be removed from the list. It is up to the caller to free the entry.
[in] | d | The entry list. |
[in] | idx | The index. |
M_bool M_fs_dir_entries_remove_at | ( | M_fs_dir_entries_t * | d, |
size_t | idx | ||
) |
Remove and destroy the entry at the given index.
[in] | d | The entry list. |
[in] | idx | The index. |
M_bool M_fs_dir_entries_remove_range | ( | M_fs_dir_entries_t * | d, |
size_t | start, | ||
size_t | end | ||
) |
Remove and destroy all entries in a given range.
[in] | d | The entry list. |
[in] | start | The starting index. Inclusive. |
[in] | end | The ending index. Inclusive. |
void M_fs_dir_entries_merge | ( | M_fs_dir_entries_t ** | dest, |
M_fs_dir_entries_t * | src | ||
) |
Merge two directory entry lists together.
The second (src) list will be destroyed automatically upon completion of this function. Any value pointers for the list will be directly copied over to the destination list, they will not be duplicated.
[in,out] | dest | Pointer by reference to the list receiving the values. if this is NULL, the pointer will simply be switched out for src. |
[in,out] | src | Pointer to the list giving up its values. |
void M_fs_dir_walk | ( | const char * | path, |
const char * | pat, | ||
M_uint32 | filter, | ||
M_fs_dir_walk_cb_t | cb, | ||
void * | thunk | ||
) |
List the contents of a directory by walking the tree.
The tree will be walked depth first. When searching for both directory and file contents, the directory entry will come after entries for the directories contents. Support for modifying while walking is OS and filesystem dependent. Thus, behavior while modifying the contents of a directory during a walk is undefined.
[in] | path | The path to walk. |
[in] | pat | Glob style pattern to filter entries in the tree. Only entries matching the pattern will be included in the output. NULL, "", and "*" will match all entries. |
[in] | filter | M_fs_dir_walk_filter_t flags controlling the behavior of the walk. |
[in] | cb | Callback for entries. |
[in] | thunk | Additional data passed to the callback. |
M_fs_dir_entries_t * M_fs_dir_walk_entries | ( | const char * | path, |
const char * | pat, | ||
M_uint32 | filter | ||
) |
List the contents of a directory by walking the tree.
[in] | path | The path to walk. |
[in] | pat | Glob style pattern to filter entries in the tree. Only entries matching the pattern will be included in the output. NULL, "", and "*" will match all entries. |
[in] | filter | M_fs_dir_walk_filter_t flags controlling the behavior of the walk. |
M_list_str_t * M_fs_dir_walk_strs | ( | const char * | path, |
const char * | pat, | ||
M_uint32 | filter | ||
) |
List the contents of a directory as a list of string paths by walking the tree.
[in] | path | The path to walk. |
[in] | pat | Glob style pattern to filter entries in the tree. Only entries matching the pattern will be included in the output. NULL, "", and "*" will match all entries. |
[in] | filter | M_fs_dir_walk_filter_t flags controlling the behavior of the walk. |
M_fs_error_t M_fs_dir_mkdir | ( | const char * | path, |
M_bool | create_parents, | ||
M_fs_perms_t * | perms | ||
) |
Create a directory.
[in] | path | The directory to create. |
[in] | create_parents | When M_TRUE create the any parents of the last directory if they do not exist instead of erroring. |
[in] | perms | Additional perms to apply to the created directory. If perms is NULL a default perms of rw-rw-r– & ~umask is used. |