/** {@inheritDoc} */ @Override public boolean setExecute(File f, boolean canExecute) { if (!isFile(f)) return false; if (!canExecute) return f.setExecutable(false, false); try { Path path = FileUtils.toPath(f); Set<PosixFilePermission> pset = Files.getPosixFilePermissions(path); // owner (user) is always allowed to execute. pset.add(PosixFilePermission.OWNER_EXECUTE); int mask = umask(); apply(pset, mask, PosixFilePermission.GROUP_EXECUTE, 1 << 3); apply(pset, mask, PosixFilePermission.OTHERS_EXECUTE, 1); Files.setPosixFilePermissions(path, pset); return true; } catch (IOException e) { // The interface doesn't allow to throw IOException final boolean debug = Boolean.parseBoolean(SystemReader .getInstance().getProperty("jgit.fs.debug")); //$NON-NLS-1$ if (debug) System.err.println(e); return false; } }
@Override public boolean setExecute(File f, boolean canExecute) { if (!isFile(f)) return false; if (!canExecute) return f.setExecutable(false); try { Path path = f.toPath(); Set<PosixFilePermission> pset = Files.getPosixFilePermissions(path); // owner (user) is always allowed to execute. pset.add(PosixFilePermission.OWNER_EXECUTE); int mask = umask(); apply(pset, mask, PosixFilePermission.GROUP_EXECUTE, 1 << 3); apply(pset, mask, PosixFilePermission.OTHERS_EXECUTE, 1); Files.setPosixFilePermissions(path, pset); return true; } catch (IOException e) { // The interface doesn't allow to throw IOException final boolean debug = Boolean.parseBoolean(SystemReader .getInstance().getProperty("jgit.fs.debug")); //$NON-NLS-1$ if (debug) System.err.println(e); return false; } }
/** {@inheritDoc} */ @Override public boolean setExecute(File f, boolean canExecute) { if (!isFile(f)) return false; if (!canExecute) return f.setExecutable(false, false); try { Path path = FileUtils.toPath(f); Set<PosixFilePermission> pset = Files.getPosixFilePermissions(path); // owner (user) is always allowed to execute. pset.add(PosixFilePermission.OWNER_EXECUTE); int mask = umask(); apply(pset, mask, PosixFilePermission.GROUP_EXECUTE, 1 << 3); apply(pset, mask, PosixFilePermission.OTHERS_EXECUTE, 1); Files.setPosixFilePermissions(path, pset); return true; } catch (IOException e) { // The interface doesn't allow to throw IOException final boolean debug = Boolean.parseBoolean(SystemReader .getInstance().getProperty("jgit.fs.debug")); //$NON-NLS-1$ if (debug) System.err.println(e); return false; } }