diff options
Diffstat (limited to 'lib/pathname.rb')
-rw-r--r-- | lib/pathname.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb index 19630415c1..bac540230f 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -860,10 +860,10 @@ class Pathname # * mixed * # Removes a file or directory, using <tt>File.unlink</tt> or # <tt>Dir.unlink</tt> as necessary. def unlink() - if FileTest.directory? @path - Dir.unlink @path - else + begin File.unlink @path + rescue Errno::EISDIR + Dir.unlink @path end end alias delete unlink |