From: nobu.nakada@... Date: 2001-03-20T13:08:18+09:00 Subject: [ruby-list:28866] Re: patch glob for MSWin32 ruby-1.6.3 なかだです。 At Tue, 20 Mar 2001 11:01:51 +0900, arton wrote: > diff dir.c.org dir.c > 538c538 > < if (len > 1 && pend[-1] == '/' > --- > > if ( > 540c540 > < && len > 2 && pend[-2] != ':' > --- > > len > 2 && pend[-2] != ':' && pend[-1] == '/' || len <= 2 && > 541a542 > > len > 1 && pend[-1] == '/' > > 無理矢理1行に入れたので、条件自体は汚いけど。 すいません、ワケ分かんなくなってしまいました。こんじゃダメ? あと UNC についてはどうなんでしょう。 *** dir.c 2001/03/19 03:20:20 1.36 --- dir.c 2001/03/20 04:04:09 *************** extract_path(p, pend) *** 562,577 **** len = pend - p; - alloc = ALLOC_N(char, len+1); - memcpy(alloc, p, len); - if (len > 1 && pend[-1] == '/' #if defined DOSISH ! && len > 2 && pend[-2] != ':' ! #endif ! ) { ! alloc[len-1] = 0; ! } ! else { ! alloc[len] = 0; } return alloc; --- 562,576 ---- len = pend - p; #if defined DOSISH ! if (len > 2) { ! if (pend[-2] != ':' && isdirsep(pend[-1])) --len; } + else + #endif + if (len > 1 && isdirsep(pend[-1])) --len; + + alloc = ALLOC_N(char, len+1); + memcpy(alloc, p, len); + alloc[len] = 0; return alloc; -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦