Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from
May 23, 2023

Conversation

github-actions[bot]
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 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 fcaa2b1)
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