public Integer invoke(File f, VirtualChannel channel) throws IOException { int mode = -1; try { mode = NativeUtils.getInstance().mode(f); } catch (NativeAccessException ex) { LOGGER.log(Level.WARNING, "Native function mod failed ({0})", NativeUtils.getInstance().getLastUnixError()); } return mode; } });
/** * Resolves symlink, if the given file is a symlink. Otherwise return null. * <p> * If the resolution fails, report an error. * * @param listener * If we rely on an external command to resolve symlink, this is it. * (TODO: try readlink(1) available on some platforms) */ public static String resolveSymlink(File link, TaskListener listener) { if (Functions.isWindows()) { return null; } try { return NativeUtils.getInstance().resolveSymlink(link); } catch (NativeAccessException exc) { listener.getLogger().print("Native function resolveSymlink failed " + NativeUtils.getInstance().getLastUnixError()); } return null; }
success = NativeUtils.getInstance().createSymlink(targetPath, baseDir); } catch (NativeAccessException ex) { errmsg = "Native function mod failed" + NativeUtils.getInstance().getLastUnixError();
/** * Run chmod natively if we can, otherwise fall back to Ant. */ public static void chmod(File f, int mask, boolean tryNative) { if (Functions.isWindows()) { return; // noop } if (tryNative) { try { NativeUtils.getInstance().chmod(f, mask); } catch (NativeAccessException exc) { LOGGER.log(Level.WARNING, "Native function chmod failed ({0}). Using Ant''s chmod task instead.", NativeUtils.getInstance().getLastUnixError()); _chmodAnt(f, mask); } } else { _chmodAnt(f, mask); } }