diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-14 15:16:19 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-14 15:16:19 +0000 |
commit | 5c55715c089f189ec1004b13de6ec6f95d9ba0af (patch) | |
tree | ae7911e847c2a31bea49a6aaa90e1cdfdb99ae8e /ext | |
parent | f214490d90b1e813114fcfde84555e15335e9794 (diff) | |
download | ruby-5c55715c089f189ec1004b13de6ec6f95d9ba0af.tar.gz |
* 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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 10 |
2 files changed, 10 insertions, 3 deletions
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); } |