From 6da6accd303be776bb4e958da52046da86f9cb5c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Tue, 22 May 2018 16:42:02 -0400 Subject: treewide: Remove uses of builtins.toPath. toPath has confusing semantics and is never necessary; it can always either just be omitted or replaced by pre-concatenating `/.`. It has been marked as "!!! obsolete?" for more than 10 years in a C++ comment, hopefully removing it will let us properly deprecate and, eventually, remove it. --- lib/strings.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/strings.nix') diff --git a/lib/strings.nix b/lib/strings.nix index e09ec42bfea..2a61b1465cc 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -492,7 +492,7 @@ rec { isStorePath = x: isCoercibleToString x && builtins.substring 0 1 (toString x) == "/" - && dirOf (builtins.toPath x) == builtins.storeDir; + && dirOf x == builtins.storeDir; /* Convert string to int Obviously, it is a bit hacky to use fromJSON that way. @@ -528,11 +528,10 @@ rec { */ readPathsFromFile = rootPath: file: let - root = toString rootPath; lines = lib.splitString "\n" (builtins.readFile file); removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); relativePaths = removeComments lines; - absolutePaths = builtins.map (path: builtins.toPath (root + "/" + path)) relativePaths; + absolutePaths = builtins.map (path: rootPath + "/${path}") relativePaths; in absolutePaths; -- cgit 1.4.1