diff options
| -rw-r--r-- | pathname_builtin.rb | 7 | ||||
| -rw-r--r-- | test/pathname/test_pathname.rb | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pathname_builtin.rb b/pathname_builtin.rb index 452c2ddee2..081b82ba9a 100644 --- a/pathname_builtin.rb +++ b/pathname_builtin.rb @@ -961,6 +961,13 @@ class Pathname # * File * # See <tt>File.utime</tt>. Update the access and modification times. def utime(atime, mtime) File.utime(atime, mtime, @path) end + # Update the access and modification times of the file. + # + # Same as Pathname#utime, but does not follow symbolic links. + # + # See File.lutime. + def lutime(atime, mtime) File.lutime(atime, mtime, @path) end + # See <tt>File.basename</tt>. Returns the last component of the path. def basename(...) self.class.new(File.basename(@path, ...)) end diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index b837f634c3..43d63041ff 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -1054,7 +1054,11 @@ class TestPathname < Test::Unit::TestCase latime = Time.utc(2000) lmtime = Time.utc(1999) File.symlink("a", "l") - Pathname("l").utime(latime, lmtime) + begin + Pathname("l").lutime(latime, lmtime) + rescue NotImplementedError + next + end s = File.lstat("a") ls = File.lstat("l") assert_equal(atime, s.atime) |
