Esempio n. 1
0
 /** Use the command chmod to set permission. */
 @Override
 public void setPermission(Path p, FsPermission permission) throws IOException {
   if (NativeIO.isAvailable()) {
     NativeIO.POSIX.chmod(pathToFile(p).getCanonicalPath(), permission.toShort());
   } else {
     String perm = String.format("%04o", permission.toShort());
     Shell.execCommand(
         Shell.getSetPermissionCommand(perm, false, FileUtil.makeShellPath(pathToFile(p), true)));
   }
 }