private Method

RDoc.setup_output_dir(op_dir, force)

Create an output dir if it doesn’t exist. If it does exist, but doesn’t contain the flag file created.rid then we refuse to use it, as we may clobber some manually generated documentation

Source Code

# File rdoc/rdoc.rb, line 110
def setup_output_dir(op_dir, force)
  flag_file = output_flag_file(op_dir)
  if File.exist?(op_dir)
    unless File.directory?(op_dir)
      error "'#{op_dir}' exists, and is not a directory" 
    end
    begin
      created = File.read(flag_file)
    rescue SystemCallError
      error "\nDirectory #{op_dir} already exists, but it looks like it\n" +
        "isn't an RDoc directory. Because RDoc doesn't want to risk\n" +
        "destroying any of your existing files, you'll need to\n" +
        "specify a different output directory name (using the\n" +
        "--op <dir> option).\n\n"
    else
      last = (Time.parse(created) unless force rescue nil)
    end
  else
    File.makedirs(op_dir)
  end
  last
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.