From 8aa17733fa55828db19bb00a9943a1f6ee61782b Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 9 Aug 2010 21:27:20 +0000 Subject: * ext/pathname/pathname.c (path_readlink): Pathname#readlink translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pathname/pathname.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ext/pathname/pathname.c') diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index f7686717d8..5894451272 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -355,6 +355,17 @@ path_open(int argc, VALUE *argv, VALUE self) } } +/* + * See File.readlink. Read symbolic link. + */ +static VALUE +path_readlink(VALUE self) +{ + VALUE str; + str = rb_funcall(rb_cFile, rb_intern("readlink"), 1, get_strpath(self)); + return rb_class_new_instance(1, &str, rb_obj_class(self)); +} + /* * == Pathname * @@ -567,4 +578,5 @@ Init_pathname() rb_define_method(rb_cPathname, "ftype", path_ftype, 0); rb_define_method(rb_cPathname, "make_link", path_make_link, 1); rb_define_method(rb_cPathname, "open", path_open, -1); + rb_define_method(rb_cPathname, "readlink", path_readlink, 0); } -- cgit v1.2.3