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

ruby-changes:12023

From: nobu <ko1@a...>
Date: Sun, 14 Jun 2009 10:51:08 +0900 (JST)
Subject: [ruby-changes:12023] Ruby:r23689 (trunk): * file.c (rb_find_file_ext, rb_find_file): canonicalize absolute

nobu	2009-06-14 10:49:23 +0900 (Sun, 14 Jun 2009)

  New Revision: 23689

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

  Log:
    * file.c (rb_find_file_ext, rb_find_file): canonicalize absolute
      paths.  [ruby-core:23845]

  Modified files:
    trunk/ChangeLog
    trunk/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23688)
+++ ChangeLog	(revision 23689)
@@ -1,5 +1,8 @@
-Sun Jun 14 10:23:16 2009  Nobuyoshi Nakada  <nobu@r...>
+Sun Jun 14 10:49:18 2009  Nobuyoshi Nakada  <nobu@r...>
 
+	* file.c (rb_find_file_ext, rb_find_file): canonicalize absolute
+	  paths.  [ruby-core:23845]
+
 	* file.c (rb_file_size): added rdoc.  a patch from Run Paint Run
 	  Run at [ruby-core:23839].
 
Index: file.c
===================================================================
--- file.c	(revision 23688)
+++ file.c	(revision 23689)
@@ -4621,12 +4621,11 @@
     }
 
     if (is_absolute_path(f) || is_explicit_relative(f)) {
-	fname = rb_str_dup(*filep);
+	fname = rb_file_expand_path(*filep, Qnil);
 	fnlen = RSTRING_LEN(fname);
 	for (i=0; ext[i]; i++) {
 	    rb_str_cat2(fname, ext[i]);
 	    if (file_load_ok(StringValueCStr(fname))) {
-		if (!is_absolute_path(f)) fname = rb_file_expand_path(fname, Qnil);
 		OBJ_FREEZE(fname);
 		*filep = fname;
 		return (int)(i+1);
@@ -4685,7 +4684,7 @@
 	    rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
 	}
 	if (!file_load_ok(f)) return 0;
-	if (!is_absolute_path(f)) path = rb_file_expand_path(path, Qnil);
+	path = rb_file_expand_path(path, Qnil);
 	return path;
     }
 

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

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