private void verifyExecutable() { if (executableFile == null) { if (executable == null) { executable = args[0].trim(); } executableFile = findPathExecutable(runtime, executable); } if (executableFile == null) { throw runtime.newErrnoENOENTError(executable); } }
private void verifyExecutable() { if (executableFile == null) { if (executable == null) { executable = args[0].trim(); } executableFile = findPathExecutable(runtime, executable); } if (executableFile == null) { throw runtime.newErrnoENOENTError(executable); } }
public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
private void verifyExecutable() { if (executableFile == null) { if (executable == null) { executable = args[0].trim(); } executableFile = findPathExecutable(runtime, executable); } if (executableFile == null) { throw runtime.newErrnoENOENTError(executable); } }
private void verifyExecutable() { if (executableFile == null) { if (executable == null) { executable = args[0].trim(); } executableFile = findPathExecutable(runtime, executable); } if (executableFile == null) { throw runtime.newErrnoENOENTError(executable); } }
public RaiseException newErrnoFromInt(int errno, String methodName, String message) { if (Platform.IS_WINDOWS && ("stat".equals(methodName) || "lstat".equals(methodName))) { if (errno == 20047) return newErrnoENOENTError(message); // boo:bar UNC stat failure if (errno == Errno.ESRCH.intValue()) return newErrnoENOENTError(message); // ESRCH on stating "" } return newErrnoFromInt(errno, message); }
private static void noFileError(IRubyObject filename) { throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " + filename.convertToString()); } }
private static void noFileError(IRubyObject filename) { throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " + filename.convertToString()); } }
private static void noFileError(IRubyObject filename) { throw filename.getRuntime().newErrnoENOENTError("No such file or directory - " + filename.convertToString()); } }
private static List<String> getEntries(Ruby runtime, String path) { if (!RubyFileTest.directory_p(runtime, RubyString.newString(runtime, path)).isTrue()) { throw runtime.newErrnoENOENTError("No such directory: " + path); } if (path.startsWith("jar:")) path = path.substring(4); if (path.startsWith("file:")) return entriesIntoAJarFile(runtime, path); return entriesIntoADirectory(runtime, path); }
public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject[] args) { RubyString file = expandPathInternal(context, args, false, true); if (!RubyFileTest.exist(context, file)) { throw context.runtime.newErrnoENOENTError(file.toString()); } return file; }
private static FileResource getExistingDir(final Ruby runtime, final String path) { FileResource result = JRubyFile.createResource(runtime, path); if (result == null || !result.exists()) { throw runtime.newErrnoENOENTError(path); } if (!result.isDirectory()) { throw runtime.newErrnoENOTDIRError(path); } return result; }
@JRubyMethod(required = 1) public IRubyObject chmod(ThreadContext context, IRubyObject arg) { checkClosed(context); int mode = (int) arg.convertToInteger().getLongValue(); if (!new File(path).exists()) { throw context.runtime.newErrnoENOENTError(path); } return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode)); }
@JRubyMethod(required = 1) public IRubyObject chmod(ThreadContext context, IRubyObject arg) { checkClosed(context); int mode = (int) arg.convertToInteger().getLongValue(); final String path = getPath(); if ( ! new File(path).exists() ) { throw context.runtime.newErrnoENOENTError(path); } return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode)); }
@JRubyMethod(required = 1) public IRubyObject chmod(ThreadContext context, IRubyObject arg) { checkClosed(context); int mode = (int) arg.convertToInteger().getLongValue(); final String path = getPath(); if ( ! new File(path).exists() ) { throw context.runtime.newErrnoENOENTError(path); } return context.runtime.newFixnum(context.runtime.getPosix().chmod(path, mode)); }
private static String[] getEntries(ThreadContext context, FileResource dir, String path) { if (!dir.isDirectory()) { if (dir.exists()) { throw context.runtime.newErrnoENOTDIRError(path); } throw context.runtime.newErrnoENOENTError(path); } if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path); String[] list = dir.list(); return list == null ? NO_FILES : list; }
@JRubyMethod(meta = true) public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject path) { RubyString file; file = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, path)); file = expandPathInternal(context, file, null, false, true); if (!RubyFileTest.exist(context, file)) { throw context.runtime.newErrnoENOENTError(file.toString()); } return file; }
private static String[] getEntries(ThreadContext context, FileResource dir, String path) { if (!dir.isDirectory()) { if (dir.exists()) { throw context.runtime.newErrnoENOTDIRError(path); } throw context.runtime.newErrnoENOENTError(path); } if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path); String[] list = dir.list(); return list == null ? NO_FILES : list; }
@JRubyMethod(meta = true) public static IRubyObject realpath(ThreadContext context, IRubyObject recv, IRubyObject path, IRubyObject cwd) { RubyString file; file = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, path)); RubyString wd = StringSupport.checkEmbeddedNulls(context.runtime, get_path(context, cwd)); file = expandPathInternal(context, file, wd, false, true); if (!RubyFileTest.exist(context, file)) { throw context.runtime.newErrnoENOENTError(file.toString()); } return file; }