Easier access to individual file permission bits #22036
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
closed-stale
Closed as the issue or PR is assumed stale
library-io
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @seaneagan
Currently FileStat has
mode
which is an opaque integer which according to the docs encodes the file permissions in its lower 16 bits, but it's not documented which bits correspond with which permissions. FileStat also hasmodeString
which might be useful for display purposes, but not for actually checking individual file permissions bits.There should be an API similar to:
enum FilePermissionRole { WORLD, GROUP, USER }
enum FilePermission { READ, WRITE, EXECUTE, STICKY, SET_UID, SET_GID }
bool hasPermission(FilePermissionRole role, FilePermission permission);
If FileStat.mode were better documented, then this could potentially be implemented in a package, instead of dart:io itself.
The text was updated successfully, but these errors were encountered: