Skip to content

Easier access to individual file permission bits #22036

@DartBot

Description

@DartBot

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 has modeString 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.closed-staleClosed as the issue or PR is assumed stalelibrary-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions