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

* file.c (rb_find_file_ext, rb_find_file): converts Windows style path

to Cygwin path.  [ruby-dev:35647]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-07-24 15:10:31 +00:00
parent 846584710a
commit d81ffff0e8
2 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Fri Jul 25 00:10:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_find_file_ext, rb_find_file): converts Windows style path
to Cygwin path. [ruby-dev:35647]
Thu Jul 24 16:30:21 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (exit_handler): use st_free_table() to free socklist.

21
file.c
View file

@ -4447,6 +4447,25 @@ file_load_ok(const char *path)
return eaccess(path, R_OK) == 0;
}
#ifdef __CYGWIN__
static void
intern_cygwin_path(volatile VALUE *path)
{
char rubylib[MAXPATHLEN];
VALUE str = *path;
const char *p = RSTRING_PTR(str);
if (*p == '\\' || has_drive_letter(p)) {
if (cygwin_conv_to_posix_path(p, rubylib) == 0) {
*path = rb_str_new2(rubylib);
}
}
}
#define intern_path(str) intern_cygwin_path(&(str))
#else
#define intern_path(str) (void)(str)
#endif
VALUE rb_get_load_path(void);
int
@ -4493,6 +4512,7 @@ rb_find_file_ext(VALUE *filep, const char *const *ext)
FilePathValue(str);
if (RSTRING_LEN(str) == 0) continue;
intern_path(str);
path = RSTRING_PTR(str);
found = dln_find_file_r(StringValueCStr(fname), path, fbuf, sizeof(fbuf));
if (found && file_load_ok(found)) {
@ -4551,6 +4571,7 @@ rb_find_file(VALUE path)
VALUE str = RARRAY_PTR(load_path)[i];
FilePathValue(str);
if (RSTRING_LEN(str) > 0) {
intern_path(str);
rb_ary_push(tmp, str);
}
}