1
0
Files

41 lines
1.3 KiB
Python
Raw Permalink Normal View History

2026-02-08 11:38:48 +08:00
import os
from pathlib import Path
class CliException(Exception):
"""Error occurs when parsing test arguments."""
pass
class Cli:
file_name: Path
"""
The path to the map for loading.
"""
ballance_dir: Path
"""
The path to the Ballance directory for finding textures
"""
encodings: tuple[str, ...]
"""
The name of encodings used by BMap for loading map.
"""
def __init__(self) -> None:
file_name = os.environ.get('BMAP_FILE_NAME', None)
if file_name is None:
raise CliException('You must specify BMAP_FILE_NAME environment variable before running this test.')
else:
self.file_name = Path(file_name).resolve()
ballance_dir = os.environ.get('BMAP_BALLANCE_DIR', None)
if ballance_dir is None:
raise CliException('You must specify BMAP_BALLANCE_DIR environment variable before running this test.')
else:
self.ballance_dir = Path(ballance_dir).resolve()
encodings = os.environ.get('BMAP_ENCODINGS', None)
if encodings is None:
raise CliException('You must specify BMAP_ENCODINGS environment variable before running this test.')
else:
self.encodings = tuple(encodings.split(','))