Sha256: 068386792815a461dfef0dd05a42a82dc6128b40a67405bbe6bdf3d14ccb09f9
Contents?: true
Size: 1002 Bytes
Versions: 4
Compression:
Stored size: 1002 Bytes
Contents
# Copyright: Copyright (c) 2005 Nicolas Pouillard. All rights reserved. # Author: Nicolas Pouillard <ertai@lrde.epita.fr>. # License: Gnu General Public License. # $LastChangedBy: polrop $ # $Id: fileutils_ex.rb 159 2005-02-18 12:07:23Z polrop $ require 'fileutils' module FileUtils alias remove_dir_without_chmod remove_dir def remove_dir (dir, force = false) #:nodoc: dir = dir.sub(%r</\z>, '') first_time_p = true begin Dir.foreach(dir) do |file| next if /\A\.\.?\z/ =~ file path = "#{dir}/#{file.untaint}" if File.symlink?(path) remove_file path, force elsif File.directory?(path) remove_dir path, force else remove_file path, force end end begin Dir.rmdir dir rescue Errno::ENOENT raise unless force end rescue if first_time_p first_time_p = false File.chmod 0777, dir retry end raise end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
ttk-0.1.576 | ruby_ex/fileutils_ex.rb |
ttk-0.1.579 | ruby_ex/fileutils_ex.rb |
ttk-0.1.580 | ruby_ex/fileutils_ex.rb |
vcs-0.2.148 | ruby_ex/fileutils_ex.rb |