From ee86fc46f29673bd0f8a45a07cba84485f824404 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 24 Jul 2008 15:10:31 +0000 Subject: * file.c (rb_find_file_ext, rb_find_file): converts Windows style path to Cygwin path. [ruby-dev:35647] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ file.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9700fefcf..8361a6250 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 25 00:10:23 2008 Nobuyoshi Nakada + + * 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 * win32/win32.c (exit_handler): use st_free_table() to free socklist. diff --git a/file.c b/file.c index 419979bcf..e8f7b9d84 100644 --- a/file.c +++ b/file.c @@ -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); } } -- cgit