From 05d9fabda16bfde3249fc0a047142e6f4a7f38d0 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 12 Aug 2010 14:39:46 +0000 Subject: [PATCH] =?UTF-8?q?*=20ext/pathname/pathname.c=20(path=5Fmake=5Fsy?= =?UTF-8?q?mlink):=20Pathname#make=5Fsymlink=20=20=20translated=20from=20p?= =?UTF-8?q?athname.rb.=20--=20=E3=81=93=E3=81=AE=E8=A1=8C=E4=BB=A5?= =?UTF-8?q?=E3=81=AF=E4=B8=8B=E7=84=A1=E8=A6=96=E3=81=95=E3=82=8C=E3=81=BE?= =?UTF-8?q?=E3=81=99=20--?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M ChangeLog M ext/pathname/lib/pathname.rb M ext/pathname/pathname.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 697225828b..b31f75e7ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 12 23:39:02 2010 Tanaka Akira + + * ext/pathname/pathname.c (path_make_symlink): Pathname#make_symlink + translated from pathname.rb. + Thu Aug 12 21:18:27 2010 Tanaka Akira * ext/pathname/pathname.c (path_lstat): Pathname#lstat translated diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 7a75b4fa47..035204e650 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -512,9 +512,6 @@ end class Pathname # * File * - # See File.symlink. Creates a symbolic link. - def make_symlink(old) File.symlink(old, @path) end - # See File.truncate. Truncate the file to +length+ bytes. def truncate(length) File.truncate(@path, length) end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 9462d26793..f98093ff87 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -393,6 +393,18 @@ path_lstat(VALUE self) return rb_funcall(rb_cFile, rb_intern("lstat"), 1, get_strpath(self)); } +/* + * call-seq: + * pathname.make_symlink(old) + * + * See File.symlink. 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 * @@ -609,4 +621,5 @@ Init_pathname() 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); }