Removes a list of files. Each parameter should be the name of the file to
delete. If the last parameter
isn’t a String, verbose mode will be
enabled. Returns the number of files deleted.
# File lib/ftools.rb, line 168
def safe_unlink(*files)
verbose = if files[-1].is_a? String then false else files.pop end
files.each do |file|
begin
unlink file
$stderr.print "removing ", file, "\n" if verbose
rescue Errno::EACCES # for Windows
continue if symlink? file
begin
mode = stat(file).mode
o_chmod mode | 0200, file
unlink file
$stderr.print "removing ", file, "\n" if verbose
rescue
o_chmod mode, file rescue nil
end
rescue
end
end
end