From: Koji Arai Date: 2001-08-18T00:06:59+09:00 Subject: [ruby-list:30952] Re: file exist check method? 新井です。 In message "[ruby-list:30949] Re: file exist check method?" on 17 Aug 2001 22:02:37 +0900, Koji Arai wrote: > 新井です。 > # 1.7 で \ がメタ文字になってないのはバグ? 以下の方が正しいようです(あるいは、DOSISHのときだけ、バック スラッシュを解釈させたくないのかな?#if defined の意図はちょっ と読み取れませんでした) Index: dir.c =================================================================== RCS file: /usr/local/cvsup/ruby/ruby/dir.c,v retrieving revision 1.50 diff -u -p -r1.50 dir.c --- dir.c 2001/07/14 15:17:18 1.50 +++ dir.c 2001/08/17 14:26:41 @@ -603,7 +603,6 @@ static void remove_backslashes(p) char *p; { -#if defined DOSISH char *pend = p + strlen(p); char *t = p; @@ -614,7 +613,6 @@ remove_backslashes(p) *t++ = *p++; } *t = '\0'; -#endif } #ifndef S_ISDIR @@ -886,10 +884,6 @@ dir_s_glob(dir, str) while (p < pend && !isdelim(*p)) { if (*p == '{') nest+=2; if (*p == '}') nest+=3; - if (*p == '\\') { - *t++ = *p++; - if (p == pend) break; - } *t++ = *p++; } *t = '\0'; 前のパッチ: touch foo\ bar foo\*bar ruby -ve 'p Dir.glob("foo\\ bar"); p Dir.glob("foo\\*bar")' ruby 1.7.1 (2001-08-14) [i586-linux] ["foo bar"] ["foo bar", "foo*bar"] 再修正後: touch foo\ bar foo\*bar ./ruby -ve 'p Dir.glob("foo\\ bar"); p Dir.glob("foo\\*bar")' ruby 1.7.1 (2001-08-14) [i586-linux] ["foo bar"] ["foo*bar"] -- 新井康司 (Koji Arai)