-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add the ability to read and modify file/directory permissions to dart:io #15078
Comments
Marked this as blocking #8101. |
There is access to file-system permission in: FileStat.stat(path).then((stat) { There are no way to set these, as of now. |
Removed Area-IO label. |
This comment was originally written by @seaneagan We also need to be able to access the current process uid and gid and FileStat uid and gid to compare them to each other to determine the process' permissions to that file/directory. Is that part of this bug, or is a separate one needed? I think it may even be possible to support it in windows, see: |
This comment was originally written by @seaneagan |
Removed Type-Defect label. |
It'd be good to add this. Having to call out to |
Jonas, I think you're the current owner of dart:io? |
Ping @sortie |
@cskau-g This issue dropped out of my inbox and I forgot about it. Sorry about that. It's easy enough to come up with a design that can a set Unix style permissions with chmod(2), much like what FileStat.mode currently exposes. However, dart:io works on both Unix and Windows, and generally avoids being designed too specifically for a particular operating system. Windows filesystem permissions are very different from Unix style permissions. Implementing Unix style permissions on Windows isn't really possible. It doesn't have the execute bit and groups work differently. Indeed that's just file permissions, there's also the owner and group of files, and the complex ACLs supported by Windows, plus the ability to set the modified times of the file, and so on. A proper solution would be to have a full API for these actions. It may need to be different depending on the operating system. I think something like this would be worthwhile and would enhance Dart as a serve side language. The problem you're trying to solve is just marking a file as executable, a concept that only exists on Unix. Running Process.run("chmod", ["-x", "--", file]) is a bit clunky, yes, but it's small and doable. I don't want to rush a special case API for just that but I'd rather like to look into a full API for filesystem operations. |
@sortie Yes, we need this. |
dart-lang/sdk#15078 Hopefully, this will be solved at some point.
Calling out to |
I really need this for [dart-git]. Is there anyway to bump the priority of this? Or at least break it down into smaller tasks, which I can try to tackle? I can use the chmod hack on systems which have |
@vHanda there are no plans to implement this any time soon. You should simply use FFI to bind to whatever underlying API the OS provides. |
Dart unfortunately doesn't provide a way, however this convenient package 'os' allows us to change it via FFI. Related to dart-lang/sdk#15078
For anyone else facing the same problem, checkout https://pub.dev/packages/posix |
I'm glad people fix it while Google is still figuring out what permissions are |
Currently Dart provides no access to filesystem permissions at all. It should do so.
The text was updated successfully, but these errors were encountered: