Made FileUtil to copy POSIX permissions
Well as a DevOps engineer, I copy scripts and other executable inside the IDE. They lose the executable flag. That bothers me for years. Here is how I try to fix that.
Also added FileObject Path conversion methods, to make the life easier.
Two questions:
- given that FileUtil.copy did not copy the attributes or is not specified as 'copied by stream content' ... isn't that an incompatible API change ?
- what about the
AclFileAttributesView- this is useful on Windows. Except for file owner, ACLs may be (usually) set by a regular user.
Well that API is ancient, from those times, when the Executable permissions could not be set by Java (pre-Java 6) without some magic.
As a DevOps Engineer, I'm working with a lot of scripts recently, so I thought I fix my issue when copy them in the IDE. That's all. I do not know how important Windows ACL for other people, well if that's really missed, contributions are welcome!
@lkishalmi still a few things to address here. I also agree with @mbien and @jtulach about 1:1 mapping behaviour with Path and Files::copy COPY_ATTRIBUTES. Not sure whether at least minimal things can be addressed and merged for NB16 or we should push all changes to NB17?
I hope I can make those minimal changes needed. The day is just started for me. If I can't make that happen, you are right, I'll move this to NB17.
@lkishalmi any thoughts on progressing this one? It's getting close to missing the NB17 cut too.
I always dreamed about 1:1 mapping between Path and FileObject. They could delegate to each other. Always. E.g. the new methods shall never return null.
Well, this PR won't make that dream true. Probably one day when someone would have a lot of time. AFAIK we need to provide a few FileSystem implementation to be able to use Path in all cases which are covered by FileObject.
As of returning null is in sync with the current implementation. Returning Optional would be an outlier in the API.
Unfortunately Files.copy made other tests fail in masterfs and filesystems module. I'll revert to the previous implementation.
BTW. This PR marks all checks passed as it was missing the Platform label.