# pathnorm

Dark Mode

- Manual
- Standard library
- Index

Search:
Group by:

OS-Path normalization. Used by `os.nim` but also generally useful for dealing with paths.

Unstable API.

# Imports

osseps

# Types

    PathIter = object
      i, prev: int
      notFirst: bool

  Source Edit

# Procs

    proc hasNext(it: PathIter; x: string): bool {...}{.raises: [], tags: [].}

  Source Edit

    proc next(it: var PathIter; x: string): (int, int) {...}{.raises: [], tags: [].}

  Source Edit

    proc addNormalizePath(x: string; result: var string; state: var int;
                          dirSep = DirSep) {...}{.raises: [], tags: [].}

  Low level proc. Undocumented. Source Edit

    proc normalizePath(path: string; dirSep = DirSep): string {...}{.raises: [], tags: [].}

  Example:

      assert normalizePath("./foo//bar/../baz") == "foo/baz"

  - Turns multiple slashes into single slashes.
  - Resolves '/foo/../bar' to '/bar'.
  - Removes './' from the path (but "foo/.." becomes ".")
  Source Edit