|
htils 1
A small set of utilities for C programming.
|
Go to the source code of this file.
Functions | |
| string * | path_canonical (arena_t *arena, const string *path) |
Gets the absolute/canonical path of path. | |
| string * | path_basename (arena_t *arena, const string *path) |
Gets the final component of path: the file name, or the last directory. | |
| string * | path_dirname (arena_t *arena, const string *path) |
| Get the dirname of a path. | |
| string * | path_extension (arena_t *arena, const string *path) |
Get the extension of path. | |
| string * | path_stem (arena_t *arena, const string *path) |
Get the stem of path. | |
| string * | path_join (arena_t *arena, const string *first, const string *second) |
| Joins two paths together. | |
| b32 | make_dir (const string *path) |
| Makes a directory. | |
| b32 | does_path_exist (const string *path) |
| Checks if a path exists. | |
| b32 | path_remove (const string *path) |
Removes a file or directory at path. | |
Checks if a path exists.
By either:
path exists using stat().path exists using GetFileAttributes().path must be valid, and cannot be null.| path | The path to check. |
Makes a directory.
By either:
path using mkdir().path using CreateDirectory().path must be valid, and cannot be null.| path | The path to the directory to make. |
Gets the final component of path: the file name, or the last directory.
By trimming previous / using pointer arithmetic and allocating the new string using arena_alloc().
arena and path must be valid and cannot be null.| arena | The arena to allocate from. |
| path | The path to get the basename of. |
Gets the absolute/canonical path of path.
Using realpath() and then allocating the new canonical path using arena_alloc().
arena and path must be valid and cannot be null.| arena | The arena to allocate from. |
| path | The path to get the absolute path of. |
Get the dirname of a path.
By trimming away the last entry of the path, and allocating the new string using arena_alloc().
arena and path must be valid and cannot be null.| arena | The arena to allocate from. |
| path | The path to get the dirname of. |
Get the extension of path.
Trims to the last extension of path, through pointer arithmetic, and allocating the new string using arena_alloc().
arena and path must be valid and cannot be null.| arena | The arena to allocate from. |
| path | The path to get the extension of. |
path without the dot, or null if it has none.Joins two paths together.
Works with paths accounting for missing trailing and leading slashes.
arena, first, and second must be valid and cannot be null.| arena | The arena to allocate from. |
| first | The first path to join. |
| second | The second path to join. |
Removes a file or directory at path.
By either:
path using remove().path using ShFileOperationW().path must be valid, and cannot be null.| path | The path to remove. |
Get the stem of path.
Trims path to its stem: the basename without the final extension, via pointer arithmetic, allocating the result with arena_alloc().
arena and path must be valid and cannot be null.| arena | The arena to allocate from. |
| path | The path to get the stem of. |