# 2.6.2.3 Decomposition

ZixStringView zix_path_extension(const char *path)

  Return the extension of the filename component of `path`.

  The “extension” is everything past the last “.” in the filename, if “.” is not the first character.

ZixStringView zix_path_filename(const char *path)

  Return the filename component of `path` without any directories.

  The filename is the name after the last directory separator. If the path has no filename, this returns null.

ZixStringView zix_path_parent_path(const char *path)

  Return the path to the directory that contains `path`.

  The parent of a root path is itself, but note that the path returned by this function may be partially normalized. For example, “/” is the parent of “/”, “//”, “/.”, and “/..”.

  If `path` has a trailing separator, it is treated like an empty filename in a directory. For example, the parent of “/a/” is “/a”.

  If `path` is relative, then this returns either a relative path to the parent if possible, or null. For example, the parent of “a/b” is “a”.

  Returns:

    A view of the parent path within `path`, or the empty string if it has no parent.

ZixStringView zix_path_relative_path(const char *path)

  Return the relative path component of path without the root directory.

  If the path has no relative path (because it is empty or a root path), this returns null.

ZixStringView zix_path_root_directory(const char *path)

  Return the root directory of `path` like “/” or “", or null.

ZixStringView zix_path_root_name(const char *path)

  Return the root name of `path` like “C:”, or null.

ZixStringView zix_path_root_path(const char *path)

  Return the root path of `path`, or null.

  The universal root path (in normal form) is “/”. Root paths are their own roots, but note that the path returned by this function may be partially normalized. For example, “/” is the root of “/”, “//”, “/.”, and “/..”.

  On Windows, the root may additionally be an absolute drive root like “C:", a relative drive root like “C:”, or a network root like “HOST”.

  Returns:

    A view of the root path within `path`, or an empty string if it has no root.

ZixStringView zix_path_stem(const char *path)

  Return the stem of the filename component of `path`.

  The “stem” is the filename without the extension, that is, everything up to the last “.” if “.” is not the first character.