lib.generators.toGitINI: move escape logic outside of hot loop

This commit is contained in:
Eman Resu
2026-05-21 16:04:12 -04:00
parent af62ce4887
commit 9b4dde7eba

View File

@@ -394,11 +394,10 @@ rec {
''${head sections} "${concatStringsSep "." (tail sections)}"'';
mkValueString =
v:
let
escapedV = ''"${replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ] v}"'';
escape = replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ];
in
mkValueStringDefault { } (if isString v then escapedV else v);
v: mkValueStringDefault { } (if isString v then ''"${escape v}"'' else v);
# generation for multiple ini values
mkKeyValue =