lib/strings: deprecate readPathsFromFile

> NOTE: This function is not performant and should be avoided.

It's not used at all in-tree now, so we can remove it completely after
any remaining users are given notice.
This commit is contained in:
V 2020-08-25 12:12:05 +02:00
parent 79921889a0
commit 423fc3f232

View File

@ -689,14 +689,15 @@ rec {
"/prefix/nix-profiles-library-paths.patch" "/prefix/nix-profiles-library-paths.patch"
"/prefix/compose-search-path.patch" ] "/prefix/compose-search-path.patch" ]
*/ */
readPathsFromFile = rootPath: file: readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead"
let (rootPath: file:
lines = lib.splitString "\n" (builtins.readFile file); let
removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); lines = lib.splitString "\n" (builtins.readFile file);
relativePaths = removeComments lines; removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line));
absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths; relativePaths = removeComments lines;
in absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths;
absolutePaths; in
absolutePaths);
/* Read the contents of a file removing the trailing \n /* Read the contents of a file removing the trailing \n