Пример #1
0
def _load_local_version_data() -> dict:
    if os.path.isfile(path_finder.get_local_version_data_path()) != True:
        _create_dummy_version_data_file()

    with open(path_finder.get_local_version_data_path()) as local_version_data_file:
        data_as_dict = toml.load(local_version_data_file)
        return data_as_dict
Пример #2
0
def _update_entry_to_local_data(entry, local_files_data):

    add_to_end = True

    if entry["name"] in local_files_data.items():
        local_files_data["version"] = entry["version"]
        local_files_data["checksum"] = entry["checksum"]
        add_to_end = False

    if add_to_end:
        local_files_data[entry["name"]] = entry

    f = open(path_finder.get_local_version_data_path(),'w')
    f.write(toml.dumps(local_files_data))
    f.flush()
    f.close()
Пример #3
0
def _create_dummy_version_data_file():
    f = open(path_finder.get_local_version_data_path(),'w+')
    print("Creating dummy version data file..")
    f.write('nwn_server_address = "' + config.nwn_server_address + '"\n\n[files]')
    f.close()