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

ruby-changes:15229

From: nobu <ko1@a...>
Date: Tue, 30 Mar 2010 18:26:49 +0900 (JST)
Subject: [ruby-changes:15229] Ruby:r27111 (trunk): * file.c (rb_file_dirname): split from rb_file_s_dirname.

nobu	2010-03-30 18:26:09 +0900 (Tue, 30 Mar 2010)

  New Revision: 27111

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

  Log:
    * file.c (rb_file_dirname): split from rb_file_s_dirname.
    
    * load.c (rb_f_require_relative): use absolute path instead of
      expanded path.

  Modified files:
    trunk/ChangeLog
    trunk/file.c
    trunk/include/ruby/intern.h
    trunk/load.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 27110)
+++ include/ruby/intern.h	(revision 27111)
@@ -355,6 +355,7 @@
 VALUE rb_file_expand_path(VALUE, VALUE);
 VALUE rb_file_s_absolute_path(int, VALUE *);
 VALUE rb_file_absolute_path(VALUE, VALUE);
+VALUE rb_file_dirname(VALUE fname);
 void rb_file_const(const char*, VALUE);
 int rb_file_load_ok(const char *);
 int rb_find_file_ext_safe(VALUE*, const char* const*, int);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27110)
+++ ChangeLog	(revision 27111)
@@ -1,3 +1,10 @@
+Tue Mar 30 18:25:52 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* file.c (rb_file_dirname): split from rb_file_s_dirname.
+
+	* load.c (rb_f_require_relative): use absolute path instead of
+	  expanded path.
+
 Tue Mar 30 13:57:08 2010  Akinori MUSHA  <knu@i...>
 
 	* process.c (proc_daemon): Process.daemon should raise an error on
Index: load.c
===================================================================
--- load.c	(revision 27110)
+++ load.c	(revision 27111)
@@ -452,13 +452,12 @@
 rb_f_require_relative(VALUE obj, VALUE fname)
 {
     VALUE rb_current_realfilepath(void);
-    VALUE rb_file_s_dirname(VALUE klass, VALUE fname);
     VALUE base = rb_current_realfilepath();
     if (NIL_P(base)) {
 	rb_raise(rb_eLoadError, "cannot infer basepath");
     }
-    base = rb_file_s_dirname(rb_cFile, base);
-    return rb_require_safe(rb_file_expand_path(fname, base), rb_safe_level());
+    base = rb_file_dirname(base);
+    return rb_require_safe(rb_file_absolute_path(fname, base), rb_safe_level());
 }
 
 static int
Index: file.c
===================================================================
--- file.c	(revision 27110)
+++ file.c	(revision 27111)
@@ -3428,9 +3428,15 @@
  *     File.dirname("/home/gumby/work/ruby.rb")   #=> "/home/gumby/work"
  */
 
-VALUE
+static VALUE
 rb_file_s_dirname(VALUE klass, VALUE fname)
 {
+    return rb_file_dirname(fname);
+}
+
+VALUE
+rb_file_dirname(VALUE fname)
+{
     const char *name, *root, *p;
     VALUE dirname;
 

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

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