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
commitafa942c241fc9eaf6fb8860061e5e5a0122c866a (patch)
treea7236f9469b1b25771e18bd54abaa9a0fd8bb0fa /lib
parentcc31822f6b518df5c24723d90e2dac227edc6d1b (diff)
downloadruby-afa942c241fc9eaf6fb8860061e5e5a0122c866a.tar.gz
ruby-afa942c241fc9eaf6fb8860061e5e5a0122c866a.tar.xz
ruby-afa942c241fc9eaf6fb8860061e5e5a0122c866a.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/branches/ruby_1_8@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 19630415c..bac540230 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