summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index d4376ef7d6..403e68be43 100644
--- a/dir.c
+++ b/dir.c
@@ -2125,12 +2125,18 @@ dir_s_home(int argc, VALUE *argv, VALUE obj)
VALUE user;
const char *u = 0;
- rb_scan_args(argc, argv, "01", &user);
+ rb_check_arity(argc, 0, 1);
+ user = (argc > 0) argv[0] : Qnil;
if (!NIL_P(user)) {
SafeStringValue(user);
+ rb_must_asciicompat(user);
u = StringValueCStr(user);
+ if (*u) {
+ return rb_home_dir_of(user, rb_str_new(0, 0));
+ }
}
- return rb_home_dir(u, rb_str_new(0, 0));
+ return rb_default_home_dir(rb_str_new(0, 0));
+
}
#if 0