mirror of https://github.com/yutto-dev/yutto
🐛 fix: load config file in `UTF-8` (#456)
Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
This commit is contained in:
parent
c55528920f
commit
63153cae3f
|
@ -34,7 +34,9 @@ DOWNLOAD_RESOURCE_TYPES: list[DownloadResourceType] = [
|
|||
|
||||
def parse_config_path() -> Path | None:
|
||||
pre_parser = argparse.ArgumentParser(description="yutto pre parser", add_help=False)
|
||||
pre_parser.add_argument("--config", type=path_from_cli, default=search_for_settings_file(), help="配置文件路径")
|
||||
pre_parser.add_argument(
|
||||
"--config", type=path_from_cli, default=search_for_settings_file(), help="配置文件路径(UTF-8 格式)"
|
||||
)
|
||||
args, _ = pre_parser.parse_known_args()
|
||||
return args.config
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ def search_for_settings_file() -> Path | None:
|
|||
|
||||
|
||||
def load_settings_file(settings_file: Path) -> YuttoSettings:
|
||||
with settings_file.open("r") as f:
|
||||
with settings_file.open("r", encoding="utf-8") as f:
|
||||
settings_raw: Any = tomllib.loads(f.read()) # pyright: ignore[reportUnknownMemberType]
|
||||
return YuttoSettings.model_validate(settings_raw)
|
||||
|
||||
|
|
Loading…
Reference in New Issue