@Override public Permission getPermission() { if(FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { final BasicFileAttributes attributes; try { return new LocalPermission(PosixFilePermissions.toString(Files.readAttributes(Paths.get(path), PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS).permissions())); } catch(IOException e) { return Permission.EMPTY; } } return Permission.EMPTY; }
@Override public boolean isWritable() { final NSURL resolved; try { resolved = local.lock(false); if(null == resolved) { return super.isWritable(); } } catch(AccessDeniedException e) { return super.isWritable(); } try { return NSFileManager.defaultManager().isWritableFileAtPath(resolved.path()); } finally { local.release(resolved); } } }
@Override public boolean isExecutable() { final NSURL resolved; try { resolved = local.lock(false); if(null == resolved) { return super.isExecutable(); } } catch(AccessDeniedException e) { return super.isExecutable(); } try { return NSFileManager.defaultManager().isExecutableFileAtPath(resolved.path()); } finally { local.release(resolved); } }
@Override public boolean isReadable() { final NSURL resolved; try { resolved = local.lock(false); if(null == resolved) { return super.isReadable(); } } catch(AccessDeniedException e) { return super.isReadable(); } try { return NSFileManager.defaultManager().isReadableFileAtPath(resolved.path()); } finally { local.release(resolved); } }