diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-12 14:39:46 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-12 14:39:46 +0000 |
commit | 05d9fabda16bfde3249fc0a047142e6f4a7f38d0 (patch) | |
tree | d76b145682dac2d2308f2372a1de10376b6b9290 /ext | |
parent | 98f53d5db2d2c78a6fb673336b28bc84bc716bf9 (diff) |
* ext/pathname/pathname.c (path_make_symlink): Pathname#make_symlink
translated from pathname.rb.
-- この行以は下無視されます --
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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 13 |
2 files changed, 13 insertions, 3 deletions
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 <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 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 @@ -394,6 +394,18 @@ path_lstat(VALUE self) } /* + * 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 @@ 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); } |