1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 16:02:43 +01:00

isInDir and isDirOrInDir: Clean up with std::filesystem

The behavior *does* change, per the tests, but I think the new behavior
is less buggy.
This commit is contained in:
John Ericson 2025-03-17 17:54:09 -04:00
parent 3286728e40
commit d3de22b2be
3 changed files with 14 additions and 16 deletions

View file

@ -105,13 +105,13 @@ std::string_view baseNameOf(std::string_view path);
* Check whether 'path' is a descendant of 'dir'. Both paths must be
* canonicalized.
*/
bool isInDir(std::string_view path, std::string_view dir);
bool isInDir(const std::filesystem::path & path, const std::filesystem::path & dir);
/**
* Check whether 'path' is equal to 'dir' or a descendant of
* 'dir'. Both paths must be canonicalized.
*/
bool isDirOrInDir(std::string_view path, std::string_view dir);
bool isDirOrInDir(const std::filesystem::path & path, const std::filesystem::path & dir);
/**
* Get status of `path`.