Skip to content

Comments

[Backport release-23.05] Improvements to pathType, pathIsDirectory and pathIsRegularFile#233560

Merged
roberth merged 8 commits intorelease-23.05from
backport-224834-to-release-23.05
May 23, 2023
Merged

[Backport release-23.05] Improvements to pathType, pathIsDirectory and pathIsRegularFile#233560
roberth merged 8 commits intorelease-23.05from
backport-224834-to-release-23.05

Conversation

@github-actions
Copy link
Contributor

Bot-based backport to release-23.05, triggered by a label in #224834.

  • Before merging, ensure that this backport complies with the Criteria for Backporting.
    • Even as a non-commiter, if you find that it does not comply, leave a comment.

infinisil and others added 8 commits May 23, 2023 07:32
These functions only work with the filesystem, they don't import
anything as sources

(cherry picked from commit c701a4d)
Co-Authored-By: Robert Hensing <[email protected]>
(cherry picked from commit a1dedc9)
Co-Authored-By: Robert Hensing <[email protected]>
(cherry picked from commit 5346636)
Previously this function couldn't handle / being passed, it would throw
an error:

error: attribute '' missing

       at nixpkgs/lib/filesystem.nix:24:20:

           23|   */
           24|   pathType = path: (readDir (dirOf path)).${baseNameOf path};
             |                    ^
           25|

Consequently this also fixes the
lib.filesystem.{pathIsDirectory,pathIsRegularFile} functions.

(cherry picked from commit bb6eab0)
Previously it would fail with

  error: attribute 'nonexistent' missing

         at nixpkgs/lib/filesystem.nix:29:10:

             28|     if dirOf path == path then "directory"
             29|     else (readDir (dirOf path)).${baseNameOf path};
               |          ^
             30|

(cherry picked from commit d064d97)
Co-Authored-By: Robert Hensing <[email protected]>
(cherry picked from commit 378bf1a)
@roberth roberth merged commit e860af4 into release-23.05 May 23, 2023
@infinisil infinisil deleted the backport-224834-to-release-23.05 branch May 23, 2023 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants