summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-15 05:50:45 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-15 05:50:45 +0000
commit671dc89d727365fa5926ffb0de31a5b51356a616 (patch)
tree1a06d2a290a4b673be05b916b6f67ad7a37f191b /lib
parent00be1c385b77c1fbde45d8f26dc036f53e0c3f67 (diff)
downloadruby-671dc89d727365fa5926ffb0de31a5b51356a616.tar.gz
ruby-671dc89d727365fa5926ffb0de31a5b51356a616.tar.xz
ruby-671dc89d727365fa5926ffb0de31a5b51356a616.zip
* lib/pathname.rb (Pathname#unlink): unlink a symlink to a directory
was failed. [ruby-core:4992] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pathname.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index be1cb29b4..83f517d49 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -868,10 +868,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