summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-24 15:10:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-24 15:10:31 +0000
commitd81ffff0e88530445eed662ae32e66bc82005d08 (patch)
treee7f02428beb3a9b79d969d93c273cd10c7008d9c /file.c
parent846584710acd41e20e537ebcf67480dc22952b13 (diff)
downloadruby-d81ffff0e88530445eed662ae32e66bc82005d08.tar.gz
* 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
Diffstat (limited to 'file.c')
-rw-r--r--file.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/file.c b/file.c
index 419979bcfd..e8f7b9d84e 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);
}
}