|
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) |
Get the basename i.e the filename.extension / final dir of path. | |
| 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. |
Get the basename i.e the filename.extension / final dir of path.
By trimming previous / using pointer arithmetic and allocating the new string using arena_alloc().
| arena | The arena to allocate from. |
| path | The path to get the basename of. |
arena and path must be valid and cannot be null.Gets the absolute/canonical path of path.
Using realpath() and then allocating the new canonical path using arena_alloc().
| arena | The arena to allocate from. |
| path | The path to get the absolute path of. |
arena and path must be valid and cannot be null.Get the dirname of a path.
By trimming away the last entry of the path, and allocating the new string using arena_alloc().
| arena | The arena to allocate from. |
| path | The path to get the dirname of. |
arena and path must be valid and cannot be null.Get the extension of path.
Trims to the last extension of path, through pointer arithmetic, and allocating the new string using arena_alloc().
| arena | The arena to allocate from. |
| path | The path to get the extension of. |
arena and path must be valid and cannot be null.Joins two paths together.
Works with paths accounting for missing trailing and leading slashes.
| arena | The arena to allocate from. |
| first | The first path to join. |
| second | The second path to join. |
arena, first, and second must be valid and cannot be null.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 to the stem of path, i.e the extension prior to the extension, through pointer arithmetic, and allocating the new string using arena_alloc().
| arena | The arena to allocate from. |
| path | The path to get the stem of. |
arena and path must be valid and cannot be null.