summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c13
3 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 90529df8fe..4b43a0d835 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 8 19:16:26 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_make_link): Pathname#make_link
+ translated from pathname.rb.
+
Sun Aug 8 16:42:48 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rubygems.rb (Gem.find_files): reverted to use globbing.
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index d2d3d8ac21..b685309e7c 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.link</tt>. Creates a hard link.
- def make_link(old) File.link(old, @path) end
-
# See <tt>File.open</tt>. Opens the file for reading or writing.
def open(*args, &block) # :yield: file
File.open(@path, *args, &block)
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 4ed17f4efd..fb023f334e 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -325,6 +325,18 @@ path_ftype(VALUE self)
}
/*
+ * call-seq:
+ * pathname.make_link(old)
+ *
+ * See <tt>File.link</tt>. Creates a hard link at _pathname_.
+ */
+static VALUE
+path_make_link(VALUE self, VALUE old)
+{
+ return rb_funcall(rb_cFile, rb_intern("link"), 2, old, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -534,4 +546,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "fnmatch", path_fnmatch, -1);
rb_define_method(rb_cPathname, "fnmatch?", path_fnmatch, -1);
rb_define_method(rb_cPathname, "ftype", path_ftype, 0);
+ rb_define_method(rb_cPathname, "make_link", path_make_link, 1);
}