diff --git a/ChangeLog b/ChangeLog index affa21454d..607752a3db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun May 15 14:35:46 2005 Tanaka Akira + + * lib/pathname.rb (Pathname#unlink): unlink a symlink to a directory + was failed. [ruby-core:4992] + Sun May 15 09:57:30 2005 Nobuyoshi Nakada * win32/win32.c (unixtime_to_filetime): deal with DST. diff --git a/lib/pathname.rb b/lib/pathname.rb index be1cb29b43..83f517d49e 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -868,10 +868,10 @@ class Pathname # * mixed * # Removes a file or directory, using File.unlink or # Dir.unlink 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