lib.normalizePath: the empty string is not a valid regex on darwin

presumably due to using libc++'s regex lib instead of libstdc++ on linux

Fixes https://github.com/NixOS/nixpkgs/pull/177273#issuecomment-1287562800
This commit is contained in:
Guillaume Girol 2022-10-23 12:00:00 +00:00 committed by zowoq
parent 90eb7cc0aa
commit 956e35d0b1

View File

@ -193,7 +193,7 @@ rec {
normalizePath "/a//b///c/"
=> "/a/b/c/"
*/
normalizePath = s: (builtins.foldl' (x: y: if y == "/" && hasSuffix "/" x then x else x+y) "" (splitString "" s));
normalizePath = s: (builtins.foldl' (x: y: if y == "/" && hasSuffix "/" x then x else x+y) "" (stringToCharacters s));
/* Depending on the boolean `cond', return either the given string
or the empty string. Useful to concatenate against a bigger string.