Unverified Commit b364a40a authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

lib.filesystem.listFilesRecursive: only flatten once (#449744)

parents 394471bd ca59048a
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -239,16 +239,15 @@ in
    ```
  */
  listFilesRecursive =
    let
      # We only flatten at the very end, as flatten is recursive.
      internalFunc =
        dir:
    lib.flatten (
      lib.mapAttrsToList (
        name: type:
        if type == "directory" then
          lib.filesystem.listFilesRecursive (dir + "/${name}")
        else
          dir + "/${name}"
      ) (builtins.readDir dir)
    );
        (lib.mapAttrsToList (
          name: type: if type == "directory" then internalFunc (dir + "/${name}") else dir + "/${name}"
        ) (builtins.readDir dir));
    in
    dir: lib.flatten (internalFunc dir);

  /**
    Transform a directory tree containing package files suitable for