API Reference › Path › Path.normalize
method

Path.normalize

Path.normalize(p) -> string

Canonicalizes a path lexically (without touching disk): duplicate separators collapse, . segments drop, and .. pops the preceding segment. An absolute path never rises above its root. The result is stable, so it is a good key for comparing or sandboxing paths.

Parameters

pthe path

Example

program Normalize {
  entry {
    if Path.normalize("a/./b/../c") == "a/c" { print(1) }
  }
}
← All symbols