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

ruby-changes:16975

From: akr <ko1@a...>
Date: Thu, 12 Aug 2010 23:40:00 +0900 (JST)
Subject: [ruby-changes:16975] Ruby:r28972 (trunk): * ext/pathname/pathname.c (path_make_symlink): Pathname#make_symlink

akr	2010-08-12 23:39:46 +0900 (Thu, 12 Aug 2010)

  New Revision: 28972

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

  Log:
    * ext/pathname/pathname.c (path_make_symlink): Pathname#make_symlink
      translated from pathname.rb.
    -- ?\227?\129?\147?\227?\129?\174?\232?\161?\140?\228?\187?\165?\227?\129?\175?\228?\184?\139?\231?\132?\161?\232?\166?\150?\227?\129?\149?\227?\130?\140?\227?\129?\190?\227?\129?\153 --
    
    M    ChangeLog
    M    ext/pathname/lib/pathname.rb
    M    ext/pathname/pathname.c

  Modified files:
    trunk/ChangeLog
    trunk/ext/pathname/lib/pathname.rb
    trunk/ext/pathname/pathname.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28971)
+++ ChangeLog	(revision 28972)
@@ -1,3 +1,8 @@
+Thu Aug 12 23:39:02 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pathname/pathname.c (path_make_symlink): Pathname#make_symlink
+	  translated from pathname.rb.
+
 Thu Aug 12 21:18:27 2010  Tanaka Akira  <akr@f...>
 
 	* ext/pathname/pathname.c (path_lstat): Pathname#lstat translated
Index: ext/pathname/lib/pathname.rb
===================================================================
--- ext/pathname/lib/pathname.rb	(revision 28971)
+++ ext/pathname/lib/pathname.rb	(revision 28972)
@@ -512,9 +512,6 @@
 
 class Pathname    # * File *
 
-  # See <tt>File.symlink</tt>.  Creates a symbolic link.
-  def make_symlink(old) File.symlink(old, @path) end
-
   # See <tt>File.truncate</tt>.  Truncate the file to +length+ bytes.
   def truncate(length) File.truncate(@path, length) end
 
Index: ext/pathname/pathname.c
===================================================================
--- ext/pathname/pathname.c	(revision 28971)
+++ ext/pathname/pathname.c	(revision 28972)
@@ -394,6 +394,18 @@
 }
 
 /*
+ * call-seq:
+ *   pathname.make_symlink(old)
+ *
+ * See <tt>File.symlink</tt>.  Creates a symbolic link.
+ */
+static VALUE
+path_make_symlink(VALUE self, VALUE old)
+{
+    return rb_funcall(rb_cFile, rb_intern("symlink"), 2, old, get_strpath(self));
+}
+
+/*
  * == Pathname
  *
  * Pathname represents a pathname which locates a file in a filesystem.
@@ -609,4 +621,5 @@
     rb_define_method(rb_cPathname, "rename", path_rename, 1);
     rb_define_method(rb_cPathname, "stat", path_stat, 0);
     rb_define_method(rb_cPathname, "lstat", path_lstat, 0);
+    rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
 }

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

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