def run(markdowndir, jsondir):
    for root, dirs, files in os.walk(jsondir):
        for name in files:
            if name[0] != '.' and name != 'reference.json':
                #print name
                data = loadJsonData(name, jsondir)

                enrichFile(data, markdowndir)
                json_file.save(jsondir, os.path.splitext(name)[0], data)
def run(of_root, outdir):
    of_source = os.path.join(of_root, "libs/openFrameworks")
    of_addons = os.path.join(of_root, "addons")

    # Prepare the outdir
    if os.path.exists(outdir):
        shutil.rmtree(outdir)
    os.makedirs(outdir)

    # Run the clang parser
    for root, dirs, files in os.walk(of_source):
        parse_folder(of_root, root, files, False)

    official_addons = [
        "ofxAccelerometer",
        "ofxAndroid",
        "ofxAssimpModelLoader",
        "ofxEmscripten",
        "ofxGui",
        "ofxNetwork",
        "ofxOpenCv",
        "ofxOsc",
        "ofxSvg",
        "ofxThreadedImageLoader",
        "ofxXmlSettings",
    ]

    # for root, dirs, files in os.walk(of_addons):
    for dir in os.listdir(of_addons):
        if dir.startswith("ofx") and os.path.isdir(os.path.join(of_addons, dir)):
            if dir in official_addons:
                # for file in os.listdir(os.path.join(of_addons, dir, 'src')):
                #    print file
                path = os.path.join(of_addons, dir, "src")
                parse_folder(of_root, path, os.listdir(path), True)

    #    parse_folder(of_root, root, files, False)

    """
    for addon in official_addons:
        for root, dirs, files in os.walk(os.path.join(of_addons, addon, "src")):
            dir_count += 1
            file_count += parse_folder(root, files, True)
    """

    # Save the output json data
    for key in json_data:
        json_file.save(outdir, key, json_data[key])

    # Save the reference file
    clang_reference.save(outdir)