Closed ImSejin closed 10 months ago
Instead of MemoryFileSystemBuilder.newEmpty()
you need to call MemoryFileSystemBuilder.newLinux()
. The former gives you a very basic file system that does not support POSIX permissions, the latter gives you a Linux-like file system.
Alternatively you can can explictly enable the PosixFileAttributeView
like so:
MemoryFileSystemBuilder.newEmpty()
.addFileAttributeView(PosixFileAttributeView.class)
.build();
The exception is raised by java.nio.file.Files#setPosixFilePermissions(Path, Set<PosixFilePermission>)
so unfortunatley we're unable to provide a more helpful error message.
One small note, in this case EnumSet.of
may be slightly more efficient than Set.of
.
Thank you! 👍🏻
Hi, I use 2.6.1
I want to set permission to the file, but
MemoryFileSystem.getLazyFileAttributeView
returnsnull
. What should I do?