def main()

in fuzzing/tools/make_corpus_dir.py [0:0]


def main(argv):
    if not os.path.exists(FLAGS.output_dir):
        os.makedirs(FLAGS.output_dir)

    expanded_file_list = []
    for corpus in FLAGS.corpus_list:
        expand_corpus_to_file_list(corpus, expanded_file_list)
    if FLAGS.corpus_list_file:
        with open(FLAGS.corpus_list_file) as corpus_list_file:
            for corpus_line in corpus_list_file:
                expand_corpus_to_file_list(
                    corpus_line.rstrip("\n"), expanded_file_list)

    if expanded_file_list:
        for corpus in expanded_file_list:
            dest = os.path.join(FLAGS.output_dir, corpus.replace("/", "-"))
            # Whatever the separator we choose, there is an chance that
            # the dest name conflicts with another file
            if os.path.exists(dest):
                print("ERROR: file " + dest + " existed.", file=stderr)
                return -1
            shutil.copy(corpus, dest)
    else:
        open(os.path.join(FLAGS.output_dir, "empty_test"), "a").close()
    return 0