normalizePath
lib.strings.normalizePath
Docs pulled from | This Revision | 18 days ago
Nixpkgs manual
Normalize path, removing extraneous /s
Inputs
s- 1. Function argument
Type
normalizePath :: String -> String
Examples
Noogle detected
Implementation
The following is the current implementation of this function.
s:
if isPath s then
throw ''
lib.strings.normalizePath: The argument (${toString s}) is a path value, but only strings are supported.
Path values are always normalised in Nix, so there's no need to call this function on them.''
else
builtins.foldl' (x: y: if y == "/" && startsWithSlash x then x else x + y) "" (
stringToCharacters s
)