@JRubyMethod(name = "file?", required = 1, module = true) public static RubyBoolean file_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { return context.runtime.newBoolean(fileResource(filename).isFile()); }
@JRubyMethod(name = "file?", required = 1, module = true) public static RubyBoolean file_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { return context.runtime.newBoolean(fileResource(filename).isFile()); }
private String resolve(String path, String scriptName) { if (RubyInstanceConfig.DEBUG_SCRIPT_RESOLUTION) { config.getError().println("Trying path: " + path); } try { FileResource fullName = JRubyFile.createRestrictedResource(path, scriptName); if (fullName.exists() && fullName.isFile()) { if (RubyInstanceConfig.DEBUG_SCRIPT_RESOLUTION) { config.getError().println("Found: " + fullName.absolutePath()); } return fullName.absolutePath(); } } catch (Exception e) { // keep going } return null; }
private String resolve(String path, String scriptName) { if (RubyInstanceConfig.DEBUG_SCRIPT_RESOLUTION) { config.getError().println("Trying path: " + path); } try { FileResource fullName = JRubyFile.createRestrictedResource(path, scriptName); if (fullName.exists() && fullName.isFile()) { if (RubyInstanceConfig.DEBUG_SCRIPT_RESOLUTION) { config.getError().println("Found: " + fullName.absolutePath()); } return fullName.absolutePath(); } } catch (Exception e) { // keep going } return null; }
@JRubyMethod(name = "file?", required = 1, module = true) public static RubyBoolean file_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { Ruby runtime = context.runtime; if (!(filename instanceof RubyFile)) { filename = get_path(context, filename); } FileResource file = fileResource(filename); return runtime.newBoolean(file.exists() && file.isFile()); }