[前][次][番号順一覧][スレッド一覧]

ruby-changes:6683

From: nobu <ko1@a...>
Date: Fri, 25 Jul 2008 00:10:51 +0900 (JST)
Subject: [ruby-changes:6683] Ruby:r18197 (trunk, ruby_1_8): * file.c (rb_find_file_ext, rb_find_file): converts Windows style path

nobu	2008-07-25 00:10:31 +0900 (Fri, 25 Jul 2008)

  New Revision: 18197

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18197

  Log:
    * file.c (rb_find_file_ext, rb_find_file): converts Windows style path
      to Cygwin path.  [ruby-dev:35647]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/file.c
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18196)
+++ ChangeLog	(revision 18197)
@@ -1,3 +1,8 @@
+Fri Jul 25 00:10:23 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* win32/win32.c (exit_handler): use st_free_table() to free socklist.
Index: file.c
===================================================================
--- file.c	(revision 18196)
+++ file.c	(revision 18197)
@@ -4447,6 +4447,25 @@
     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 @@
 
 	    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 @@
 	    VALUE str = RARRAY_PTR(load_path)[i];
 	    FilePathValue(str);
 	    if (RSTRING_LEN(str) > 0) {
+		intern_path(str);
 		rb_ary_push(tmp, str);
 	    }
 	}
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 18196)
+++ ruby_1_8/ChangeLog	(revision 18197)
@@ -1,3 +1,8 @@
+Fri Jul 25 00:10:23 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* ext/win32ole/win32ole.c: got rid of improper casts.
Index: ruby_1_8/file.c
===================================================================
--- ruby_1_8/file.c	(revision 18196)
+++ ruby_1_8/file.c	(revision 18197)
@@ -4388,6 +4388,25 @@
     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 @@
 
 	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 @@
 	    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 @@
  *  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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]