From 2ed799f834d30e7f89fb92dd4d109ac00d46e7b3 Mon Sep 17 00:00:00 2001 From: eban Date: Tue, 13 Mar 2001 07:58:07 +0000 Subject: [PATCH] * dir.c (rb_glob_helper): fix drive letter handling on DOSISH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ dir.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7563cb3831..9df7978467 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Mar 13 16:39:45 2001 WATANABE Hirofumi + + * dir.c (rb_glob_helper): fix drive letter handling on DOSISH. + Tue Mar 13 15:01:12 2001 Minero Aoki * lib/net/http.rb: add HTTPRequest#basic_auth. diff --git a/dir.c b/dir.c index 0f5202a2e7..a7945f8fc0 100644 --- a/dir.c +++ b/dir.c @@ -535,7 +535,11 @@ extract_path(p, pend) len = pend - p; alloc = ALLOC_N(char, len+1); memcpy(alloc, p, len); - if (len > 1 && pend[-1] == '/') { + if (len > 1 && pend[-1] == '/' +#if defined DOSISH + && len > 2 && pend[-2] != ':' +#endif + ) { alloc[len-1] = 0; } else { @@ -621,7 +625,11 @@ rb_glob_helper(path, flag, func, arg) break; } +#if defined DOSISH +#define BASE (*base && !((isdirsep(*base) && !base[1]) || (base[1] == ':' && isdirsep(base[2]) && !base[3]))) +#else #define BASE (*base && !(*base == '/' && !base[1])) +#endif for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { if (recursive) {