Skip to content

Commit

Permalink
lib.normalizePath: the empty string is not a valid regex on darwin
Browse files Browse the repository at this point in the history
presumably due to using libc++'s regex lib instead of libstdc++ on linux

Fixes NixOS/nixpkgs#177273 (comment)
  • Loading branch information
symphorien authored and zowoq committed Oct 24, 2022
1 parent 7af308a commit 6ce84b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/strings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6ce84b7

Please sign in to comment.