summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-11 00:42:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-11 00:42:16 +0000
commit075e78b39b62d67acee9fb6008898673cf0b1ac1 (patch)
tree76721a02eb4715887dcbccb5ccf310cfdc70d3a6 /dir.c
parenta9eea1bc50d2d07d4eeee162445feeb18f5b4550 (diff)
* dir.c (rb_push_glob): Dir.glob should have call its block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index 5c7f1cc5db..f0b1f00f23 100644
--- a/dir.c
+++ b/dir.c
@@ -939,18 +939,18 @@ glob_helper(pv, sub, flags, func, arg)
p = sub ? sub : path;
if (!has_magic(p, 0, flags)) {
#if defined DOSISH
- remove_backslashes(RSTRING(path)->ptr);
+ remove_backslashes(path);
#else
if (!(flags & FNM_NOESCAPE)) remove_backslashes(p);
#endif
- if (lstat(RSTRING(path)->ptr, &st) == 0) {
- status = glob_call_func(func, path, arg);
+ if (lstat(path, &st) == 0) {
+ status = glob_call_func(func, pv, arg);
if (status) return status;
}
else if (errno != ENOENT) {
/* In case stat error is other than ENOENT and
we may want to know what is wrong. */
- rb_sys_warning(RSTRING(path)->ptr);
+ rb_sys_warning(path);
}
return 0;
}
@@ -1119,7 +1119,7 @@ rb_glob(path, func, arg)
args.func = func;
args.arg = arg;
- status = rb_glob2(rb_str_new2(path), 0, func, &args);
+ status = rb_glob2(rb_str_new2(path), 0, rb_glob_caller, &args);
if (status) rb_jump_tag(status);
}
@@ -1254,6 +1254,10 @@ rb_push_glob(str, flags)
/* else unmatched braces */
}
if (status) rb_jump_tag(status);
+ if (rb_block_given_p()) {
+ rb_ary_each(ary);
+ return Qnil;
+ }
return ary;
}