module Cucumber::Formatter::Io

def ensure_file(path, name)

def ensure_file(path, name)
  raise "You *must* specify --out FILE for the #{name} formatter" unless path.instance_of? String
  raise "I can't write #{name} to a directory - it has to be a file" if File.directory?(path)
  raise "I can't write #{name} to a file in the non-existing directory #{File.dirname(path)}" unless File.directory?(File.dirname(path))
  ensure_io(path, nil)
end