1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (rb_file_s_expand_path): accept drive letter on Cygwin.

* file.c (is_absolute_path): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2002-08-20 10:42:57 +00:00
parent c8c55db68a
commit 80caadabe9
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Tue Aug 20 19:39:03 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* file.c (rb_file_s_expand_path): accept drive letter on Cygwin.
* file.c (is_absolute_path): ditto.
Tue Aug 20 12:12:25 2002 Tietew <tietew@tietew.net> Tue Aug 20 12:12:25 2002 Tietew <tietew@tietew.net>
* io.c (rb_io_putc): output via rb_io_write(). * io.c (rb_io_putc): output via rb_io_write().

9
file.c
View file

@ -1463,7 +1463,7 @@ rb_file_s_expand_path(argc, argv)
#endif #endif
} }
} }
#if defined DOSISH #if defined DOSISH || defined __CYGWIN__
/* skip drive letter */ /* skip drive letter */
else if (ISALPHA(s[0]) && s[1] == ':' && isdirsep(s[2])) { else if (ISALPHA(s[0]) && s[1] == ':' && isdirsep(s[2])) {
b = s; b = s;
@ -1561,7 +1561,7 @@ rb_file_s_expand_path(argc, argv)
memcpy(++p, b, s-b); memcpy(++p, b, s-b);
p += s-b; p += s-b;
} }
#if defined(DOSISH) #if defined DOSISH || defined __CYGWIN__
else if (ISALPHA(buf[0]) && (buf[1] == ':') && isdirsep(buf[2])) { else if (ISALPHA(buf[0]) && (buf[1] == ':') && isdirsep(buf[2])) {
/* root directory needs a trailing backslash, /* root directory needs a trailing backslash,
otherwise it mean the current directory of the drive */ otherwise it mean the current directory of the drive */
@ -2318,10 +2318,11 @@ static int
is_absolute_path(path) is_absolute_path(path)
const char *path; const char *path;
{ {
#ifdef DOSISH #if defined DOSISH || defined __CYGWIN__
if (ISALPHA(path[0]) && path[1] == ':' && isdirsep(path[2])) return 1; if (ISALPHA(path[0]) && path[1] == ':' && isdirsep(path[2])) return 1;
if (isdirsep(path[0]) && isdirsep(path[1])) return 1; if (isdirsep(path[0]) && isdirsep(path[1])) return 1;
#else #endif
#ifndef DOSISH
if (path[0] == '/') return 1; if (path[0] == '/') return 1;
#endif #endif
return 0; return 0;