mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-03 03:08:29 +02:00
27 lines
871 B
Python
27 lines
871 B
Python
import subprocess
|
|
from . import error
|
|
|
|
WBMGT_PATH = "./tools/szs/wbmgt"
|
|
|
|
|
|
@error.better_wszst_error(wszst_tools=WBMGT_PATH)
|
|
def encode(file: str) -> None:
|
|
"""
|
|
Encode a txt file into a bmg file
|
|
:param file: txt file to convert
|
|
"""
|
|
subprocess.run([WBMGT_PATH, "ENCODE", file, "--overwrite"],
|
|
creationflags=subprocess.CREATE_NO_WINDOW)
|
|
|
|
|
|
@error.better_wszst_error(wszst_tools=WBMGT_PATH)
|
|
def cat(path: str, subfile: str = ".d/message/Common.bmg") -> str:
|
|
"""
|
|
read a bmg file
|
|
:param path: path to a szs file
|
|
:param subfile: path to a subdirectory
|
|
:return: bmg definition
|
|
"""
|
|
return subprocess.run([WBMGT_PATH, "CAT", path + subfile],
|
|
creationflags=subprocess.CREATE_NO_WINDOW,
|
|
check=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout.decode()
|