From 5c55715c089f189ec1004b13de6ec6f95d9ba0af Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 14 Aug 2010 15:16:19 +0000 Subject: [PATCH] * ext/pathname/pathname.c (path_utime): Pathname#utime translated from pathname.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/pathname/lib/pathname.rb | 3 --- ext/pathname/pathname.c | 10 ++++++++++ 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 + + * ext/pathname/pathname.c (path_utime): Pathname#utime translated + from pathname.rb. + Sat Aug 14 21:04:28 2010 Nobuyoshi Nakada * 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 File.utime. Update the access and modification times. - def utime(atime, mtime) File.utime(atime, mtime, @path) end - # See File.basename. 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 @@ -414,6 +414,15 @@ path_truncate(VALUE self, VALUE length) return rb_funcall(rb_cFile, rb_intern("truncate"), 2, get_strpath(self), length); } +/* + * See File.utime. 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 * @@ -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); }