summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-10 13:29:14 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-10 13:29:14 +0000
commit2f3cfe19ca558dc26bf9cd1a9d81e3955e2edfcb (patch)
treece4ff46921debda4d47c03fac44a938e7f505f7f
parent911f4e67232919cb9df33da7843e723e9ace0c74 (diff)
* lib/fileutils.rb (remove_dir): should handle symlink correctly. This patch is contributed by Christian Loew. [ruby-talk:94635] (Backport from main trunk)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@5939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/fileutils.rb4
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fbcb46a6..ba46021bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Mar 10 22:28:09 2004 Minero Aoki <aamine@loveruby.net>
+
+ * lib/fileutils.rb (remove_dir): should handle symlink correctly.
+ This patch is contributed by Christian Loew. [ruby-talk:94635]
+ (Backport from main trunk)
+
Wed Mar 10 16:28:42 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (return_jump): set return value to the return
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index d34e6fec4..8b4ec9d80 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -581,7 +581,9 @@ module FileUtils
Dir.foreach(dir) do |file|
next if /\A\.\.?\z/ === file
path = "#{dir}/#{file}"
- if File.directory?(path)
+ if File.symlink?(path)
+ remove_file path, force
+ elsif File.directory?(path)
remove_dir path, force
else
remove_file path, force