diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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); } } |