summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-24 22:53:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-24 22:53:51 +0000
commiteec0b2d88a68d7931ff1d41c5cc2c773f7f22c6c (patch)
tree42449d482126683b6649ddf0eb58ce43484bb6e7 /dir.c
parent85738261a582ceef498b86b784171fba59bf60cc (diff)
* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
[Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 8383adc6f0..b0a1d9eaf5 100644
--- a/dir.c
+++ b/dir.c
@@ -485,8 +485,12 @@ dir_inspect(VALUE dir)
TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
if (!NIL_P(dirp->path)) {
- const char *c = rb_obj_classname(dir);
- return rb_sprintf("#<%s:%s>", c, RSTRING_PTR(dirp->path));
+ VALUE str = rb_str_new_cstr("#<");
+ rb_str_append(str, rb_class_name(CLASS_OF(dir)));
+ rb_str_cat2(str, ":");
+ rb_str_append(str, dirp->path);
+ rb_str_cat2(str, ">");
+ return str;
}
return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}