@Override public String canonicalPath() { // Seems like for Ruby absolute path implies resolving system links, // so canonicalization is in order. try { return file.getCanonicalPath(); } catch (IOException ioError) { // I guess absolute path is next best thing? return file.getAbsolutePath(); } }
@Override public String canonicalPath() { // Seems like for Ruby absolute path implies resolving system links, // so canonicalization is in order. try { return file.getCanonicalPath(); } catch (IOException ioError) { // I guess absolute path is next best thing? return file.getAbsolutePath(); } }
@Override public String absolutePath() { return RubyFile.canonicalize(file.getAbsolutePath()); }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw (IOException) new IOException("Unable to canonicalize path: " + getAbsolutePath()).initCause(e); } }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw new IOException("Unable to canonicalize path: " + getAbsolutePath(), e); } }
@Override public String getCanonicalPath() throws IOException { try { return normalizeSeps(super.getCanonicalPath()); } catch (IOException e) { // usually IOExceptions don't tell us anything about the path, // so add an extra wrapper to give more debugging help. throw new IOException("Unable to canonicalize path: " + getAbsolutePath(), e); } }
@Override public FileStat lstat() { FileStat stat = posix.allocateStat(); return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat lstat() { FileStat stat = posix.allocateStat(); return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat stat() { FileStat stat = posix.allocateStat(); return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat stat() { FileStat stat = posix.allocateStat(); return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
public static IRubyObject rowned_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isROwned()); }
@JRubyMethod(name = "executable_real?", required = 1, module = true) public static IRubyObject executable_real_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isExecutableReal()); }
@JRubyMethod(name = "blockdev?", required = 1, module = true) public static IRubyObject blockdev_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isBlockDev()); }
@JRubyMethod(name = "pipe?", required = 1, module = true) public static IRubyObject pipe_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isNamedPipe()); }
@JRubyMethod(name = "setgid?", required = 1, module = true) public static IRubyObject setgid_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isSetgid()); }
@JRubyMethod(name = "socket?", required = 1, module = true) public static IRubyObject socket_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isSocket()); }
@JRubyMethod(name = "owned?", required = 1, module = true) public static IRubyObject owned_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isOwned()); }
@JRubyMethod(name = "setuid?", required = 1, module = true) public static IRubyObject setuid_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isSetuid()); }
@JRubyMethod(name = "executable?", required = 1, module = true) public static IRubyObject executable_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isExecutable()); }
@JRubyMethod(name = "grpowned?", required = 1, module = true) public static IRubyObject grpowned_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); // JRUBY-4446, grpowned? always returns false on Windows if (Platform.IS_WINDOWS) { return runtime.getFalse(); } return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isGroupOwned()); }