2.6.2.2 Lexical Transformations — Zix 0.4.2 documentation

# 2.6.2.2 Lexical Transformations

char *zix_path_preferred(ZixAllocator *allocator, const char *path)

  Return `path` with preferred directory separators.

  The returned path will be a copy of `path` with any directory separators converted to the preferred separator (backslash on Windows, slash everywhere else).

char *zix_path_lexically_normal(ZixAllocator *allocator, const char *path)

  Return `path` converted to normal form.

  Paths in normal form have all dot segments removed and use only a single preferred separator for all separators (that is, any number of separators is replaced with a single “" on Windows, and a single “/” everwhere else).

  Note that this function doesn’t access the filesystem, so won’t do anything like case normalization or symbolic link dereferencing. For that, use `zix_canonical_path()`.

char *zix_path_lexically_relative(ZixAllocator *allocator, const char *path, const char *base)

  Return `path` relative to `base` if possible.

  If `path` is not within `base`, a copy is returned. Otherwise, an equivalent path relative to `base` is returned (which may contain up-references).