Closed scottchiefbaker closed 2 months ago
Perhaps an interface like ->permissions('user')
, ->permissions('group')
..?
That's not too bad... Alternately we could do something like
$bool = $path->is_readable('user');
$bool = $path->is_writable('group');
$bool = $path->is_executable('other');
This ended up being not as complicated as I thought so I coded it up and landed a PR for it.
NB. PR is #296 .
Sorry it's taken me a while to get to this. After some considerations, I'm going to pass on this API extension. Path::Tiny already provides stat
, so these sorts of checks are relatively straightforward uses of $path->stat->mode
.
Recently I need to determine if a file was world readable which requires fetching the permissions, and masking out the "other" permissions from the result. I ended up with this:
Is this something you would consider for inclusion in
Path::Tiny
? I can work on a PR if this is something you would be willing to land.