summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/pathname/lib/pathname.rb3
-rw-r--r--ext/pathname/pathname.c10
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f2fe71b045..e248d82001 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 15 00:15:45 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_utime): Pathname#utime translated
+ from pathname.rb.
+
Sat Aug 14 21:04:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (rb_gc_mark_threads): deprecated.
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index d1a7b5c856..baadec4196 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -512,9 +512,6 @@ end
class Pathname # * File *
- # See <tt>File.utime</tt>. Update the access and modification times.
- def utime(atime, mtime) File.utime(atime, mtime, @path) end
-
# See <tt>File.basename</tt>. Returns the last component of the path.
def basename(*args) self.class.new(File.basename(@path, *args)) end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index a1d260f3ad..ca7377c85a 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -415,6 +415,15 @@ path_truncate(VALUE self, VALUE length)
}
/*
+ * See <tt>File.utime</tt>. Update the access and modification times.
+ */
+static VALUE
+path_utime(VALUE self, VALUE atime, VALUE mtime)
+{
+ return rb_funcall(rb_cFile, rb_intern("utime"), 3, atime, mtime, get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -632,4 +641,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "lstat", path_lstat, 0);
rb_define_method(rb_cPathname, "make_symlink", path_make_symlink, 1);
rb_define_method(rb_cPathname, "truncate", path_truncate, 1);
+ rb_define_method(rb_cPathname, "utime", path_utime, 2);
}