summaryrefslogtreecommitdiff
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
commitebca84754989c963c88c18c2964950dbf537a3d5 (patch)
treea791ebd8edfff679662c0583f50f9bd1f625f550
parenta9db2aad7a3162080d4e7f86260ec7712dba7d0c (diff)
* 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/branches/ruby_1_8@18197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--file.c22
2 files changed, 27 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a5c70ff0f8..05396b114d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 07:01:13 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/win32ole/win32ole.c: got rid of improper casts.
diff --git a/file.c b/file.c
index ca80795817..fdc06184ec 100644
--- a/file.c
+++ b/file.c
@@ -4388,6 +4388,25 @@ file_load_ok(file)
return 1;
}
+#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
+
extern VALUE rb_load_path;
int
@@ -4431,6 +4450,7 @@ rb_find_file_ext(filep, ext)
SafeStringValue(str);
if (RSTRING(str)->len == 0) continue;
+ intern_path(str);
path = RSTRING(str)->ptr;
for (j=0; ext[j]; j++) {
fname = rb_str_dup(*filep);
@@ -4492,6 +4512,7 @@ rb_find_file(path)
VALUE str = RARRAY(rb_load_path)->ptr[i];
SafeStringValue(str);
if (RSTRING(str)->len > 0) {
+ intern_path(str);
rb_ary_push(tmp, str);
}
}
@@ -4551,6 +4572,7 @@ define_filetest_function(name, func, argc)
* file:
*
* The permission bits <code>0644</code> (in octal) would thus be
+ intern_path(str);
* interpreted as read/write for owner, and read-only for group and
* other. Higher-order bits may also be used to indicate the type of
* file (plain, directory, pipe, socket, and so on) and various other