2.6.1.3 Resolution¶
-
char *
zix_canonical_path
(ZixAllocator *allocator, const char *path)¶ Return
path
as a canonical absolute path to a “real” file.This expands all symbolic links, relative references, and removes extra directory separators.
Since this function may return null anyway, it accepts a null parameter to allow easier chaining of path functions when only the final result is required, for example:
char* path = zix_path_join(alloc, "/some/dir", "filename.txt"); char* canonical = zix_canonical_path(path); if (canonical) { // Do something with the canonical path... } else { // No canonical path for some reason, we don't care which... }
- Returns
A new canonical version of
path
, or null if it doesn’t exist.