def setup_output_dir(dir, force)
flag_file = output_flag_file dir
last = {}
if @options.dry_run then
elsif File.exist? dir then
error "#{dir} exists and is not a directory" unless File.directory? dir
begin
open flag_file do |io|
unless force then
Time.parse io.gets
io.each do |line|
file, time = line.split "\t", 2
time = Time.parse(time) rescue next
last[file] = time
end
end
end
rescue SystemCallError, TypeError
error "\nDirectory \#{dir} already exists, but it looks like it isn't an RDoc directory.\n\nBecause RDoc doesn't want to risk destroying any of your existing files,\nyou'll need to specify a different output directory name (using the --op <dir>\noption)\n\n"
end unless @options.force_output
else
FileUtils.mkdir_p dir
FileUtils.touch output_flag_file dir
end
last
end