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

Easier access to individual file permission bits #22036

Closed
DartBot opened this issue Jan 9, 2015 · 2 comments
Closed

Easier access to individual file permission bits #22036

DartBot opened this issue Jan 9, 2015 · 2 comments
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

Comments

@DartBot
Copy link

DartBot commented Jan 9, 2015

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.

@floitschG
Copy link
Contributor

Added Area-Library, Library-IO, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jan 9, 2015

This comment was originally written by @seaneagan


I figured out the bit permission mapping from the implementation of modeString:

https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/sdk/lib/io/file_system_entity.dart#­158

So here's a draft implementation of the above API:

https://gist.github.com/seaneagan/e01ae92825694a4f4dc4

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels Jan 9, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@lrhn lrhn closed this as completed Apr 8, 2024
@lrhn lrhn added the closed-stale Closed as the issue or PR is assumed stale label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants