platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java in rhodes-2.1.0 vs platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java in rhodes-2.2.0.beta.1

- old
+ new

@@ -53,11 +53,11 @@ ////@RubyLevelMethod(name="exist?", alias="exists?", singleton=true) public static RubyValue exist_question(RubyValue receiver, RubyValue arg) { String fileName = arg.toStr(); boolean bExist = false; - if ( fileName.startsWith("/apps")) + if ( fileName.startsWith("/apps") || fileName.startsWith("/lib") || fileName.startsWith("/RhoBundle") ) bExist = RhoSupport.findClass(fileName)!=null; if ( !bExist ) bExist = RhoRuby.resourceFileExists(fileName); @@ -136,16 +136,18 @@ //@RubyLevelMethod(name="dirname", singleton=true) public static RubyValue dirname(RubyValue receiver, RubyValue arg) { String fileName = arg.toStr(); File file = new File(fileName); String parent = file.getParent(); - if (parent == null) { - return ObjectFactory.createString(StringMe.matches(fileName, "\\/+") ? "/" : "."); - } + + return ObjectFactory.createString(parent != null ? parent : "/"); + //if (parent == null) { + // return ObjectFactory.createString(StringMe.matches(fileName, "\\/+") ? "/" : "."); + //} //Java's File.getParent() always converts '/' to '\\' on windows. This is not //what we want, so here we hack the result with replace(). - return ObjectFactory.createString(parent.replace('\\', '/')); + //return ObjectFactory.createString(parent.replace('\\', '/')); } //@RubyLevelMethod(name="mtime", singleton=true) public static RubyValue mtime(RubyValue receiver, RubyValue arg) { String fileName = arg.toStr();