SHTK_FS_NORMALIZE_PATH(3)

NAME
shtk_fs_normalize_path - Returns a normalized form of a path

LIBRARY
shtk_import fs

SYNOPSIS
shtk_fs_normalize_path path

DESCRIPTION
The shtk_fs_normalize_path function takes the given path and prints its normalized form to stdout.

This process involves the following:

•   Collapsing multiple consecutive forward slashes into one.

•   Adding a ~. component at the beginning of the path if it is relative.

•   Removing any ~. components, except for the first one.

•   Removing any trailing slashes.

Note that the normalization happens without performing any file system operations. Therefore, it is perfectly possible for two normalized paths that look different to point to the same file system entry. In particular, this is because normalization does not take into account links nor.. components.

RETURN VALUES
shtk_fs_normalize_path returns 0.

EXAMPLES

    shtk_fs_normalize_path /foo/bar  # Prints /foo/bar
    shtk_fs_normalize_path foo/bar  # Prints ./foo/bar
    shtk_fs_normalize_path foo///bar/./baz//  # Prints ./foo/bar/baz

SEE ALSO
shtk(3), shtk_fs(3)

HISTORY
shtk_fs_normalize_path first appeared in shtk 1.7.