def load():
    global app, executable, dsym_folder, symbolicatecrash, dsym_uuid_dict, dsym_uuid_dict_file

    Log.info("                  app: " + app)
    Log.info("           executable: " + executable)
    Log.info("  dsym_uuid_dict_file: " + dsym_uuid_dict_file)

    if not os.path.exists(dsym_folder):
        Log.error("dsym folder not exist, dsym folder: " + dsym_folder)
        return False
    else:
        Log.info("          dsym folder: " + dsym_folder)

    symbolicatecrash = symbolicatecrash_file_path()
    if symbolicatecrash == "":
        Log.error("can NOT find symbolicatecrash")
        return False
    else:
        Log.info("     symbolicatecrash: " + symbolicatecrash)

    if os.path.exists(dsym_uuid_dict_file):
        dsym_uuid = load_dsym_uuid_dict(dsym_uuid_dict_file)
        Log.info("loaded dsym_uuid_dict: " + dsym_uuid_dict_file)

    Log.sep()
    return True
def handle_dir(app, executable, dsym_folder='./dsym', dir_path='./crash'):
    CrashReportLib.app = app
    CrashReportLib.executable = executable
    CrashReportLib.dsym_folder = dsym_folder
    
    if not CrashReportLib.load():
        return
    
    for dirpath, dirnames, filenames in os.walk(dir_path):
        for filename in filenames:
            if filename.endswith('.plcrash'):
                file_path = os.path.join(dirpath,filename)
                CrashReportLib.handle(file_path)
                Log.sep()

    CrashReportLib.save()