INNER CODE UNIT · Python

write_directory_list_file

multitheftauto/mtasa-blue · utils/localization/build_gettext_catalog.py:39

def write_directory_list_file(files: t.List[Path], fp: t.TextIO):
    fp.writelines(f"{path}\n" for path in files)


def main(output: Path, version: str, xgettext: str, paths: t.Optional[t.List[Path]] = None) -> None:
    paths = paths or [Path("Client"), Path("Shared")]

    # If we have .pot in the destination, strip it (xgettext seems to append an extension regardless)
    output = output.with_suffix("")

    files = get_source_files_from_dirs(paths)
    print ( f"Files found: {len(files)}" )

    # xgettext requires a list of filepaths in a newline delimited file
    # so we create a tmpfile containing all our paths and give it to xgettext
    fd, fp_path = tempfile.mkstemp()
    fp_path = Path(fp_path)
    with fp_path.open("w", encoding="utf-8") as fp:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…