Skip to content

Instantly share code, notes, and snippets.

@aurelian
Created May 15, 2009 16:28
Show Gist options
  • Select an option

  • Save aurelian/112285 to your computer and use it in GitHub Desktop.

Select an option

Save aurelian/112285 to your computer and use it in GitHub Desktop.
diff --git a/src/org/jruby/RubyDir.java b/src/org/jruby/RubyDir.java
index dd893e8..d23ba5b 100644
--- a/src/org/jruby/RubyDir.java
+++ b/src/org/jruby/RubyDir.java
@@ -249,7 +249,7 @@ public class RubyDir extends RubyObject {
RubyString path = args.length == 1 ?
(RubyString) args[0].convertToString() : getHomeDirectoryPath(context);
String adjustedPath = RubyFile.adjustRootPathOnWindows(
- recv.getRuntime(), path.toString(), null);
+ recv.getRuntime(), path.getUnicodeValue(), null);
checkDirIsTwoSlashesOnWindows(recv.getRuntime(), adjustedPath);
JRubyFile dir = getDir(recv.getRuntime(), adjustedPath, true);
String realPath = null;
@@ -297,7 +297,7 @@ public class RubyDir extends RubyObject {
*/
@JRubyMethod(name = {"rmdir", "unlink", "delete"}, required = 1, meta = true)
public static IRubyObject rmdir(IRubyObject recv, IRubyObject path) {
- JRubyFile directory = getDir(recv.getRuntime(), path.convertToString().toString(), true);
+ JRubyFile directory = getDir(recv.getRuntime(), path.convertToString().getUnicodeValue(), true);
if (!directory.delete()) {
throw recv.getRuntime().newSystemCallError("No such directory");
@@ -344,7 +344,8 @@ public class RubyDir extends RubyObject {
public static IRubyObject mkdir(IRubyObject recv, IRubyObject[] args) {
Ruby runtime = recv.getRuntime();
runtime.checkSafeString(args[0]);
- String path = args[0].toString();
+
+ String path= args[0].convertToString().getUnicodeValue();
File newDir = getDir(runtime, path, false);
if (File.separatorChar == '\\') {
diff --git a/src/org/jruby/RubyFile.java b/src/org/jruby/RubyFile.java
index de0a9db..4801266 100644
--- a/src/org/jruby/RubyFile.java
+++ b/src/org/jruby/RubyFile.java
@@ -1219,7 +1219,7 @@ public class RubyFile extends RubyIO implements EncodingCapable {
}
String element;
if (args[i] instanceof RubyString) {
- element = args[i].toString();
+ element = args[i].convertToString().getUnicodeValue(); //toString();
} else if (args[i] instanceof RubyArray) {
if (runtime.isInspecting(args[i])) {
element = "[...]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment