Commit 99d0ccd3 authored by wanli's avatar wanli

🐞 fix: 打开关闭文件添加格式参数

parent 246189a9
......@@ -398,7 +398,7 @@ def parse_header_files():
config_file = "typeconfig.json"
typeconfig = {}
if os.path.exists(config_file):
with open(config_file, "r") as f:
with open(config_file, "r", encoding="utf-8") as f:
typeconfig = json.loads(f.read())
if len(typeconfig.keys()) > 0:
......@@ -412,7 +412,7 @@ def parse_header_files():
result = parse_header_file(file.resolve().as_posix(), undefined_type, error_tips)
if result != None:
target = target_path.joinpath(".json".format(file.name))
with open(target.resolve().as_posix(), "w+") as f:
with open(target.resolve().as_posix(), "w+", encoding="utf-8") as f:
f.write(json.dumps(result))
result_list.append(result)
......@@ -452,7 +452,7 @@ def process_parse():
config_file = "typeconfig.json"
typeconfig = {}
if os.path.exists(config_file):
with open(config_file, "r") as f:
with open(config_file, "r", encoding="utf-8") as f:
typeconfig = json.loads(f.read())
if not typeconfig:
typeconfig = {}
......@@ -462,7 +462,7 @@ def process_parse():
if len(typeconfig.keys()) > 0:
conf = update_mark_type(typeconfig)
with open(config_file, "w") as f:
with open(config_file, "w", encoding="utf-8") as f:
f.write(json.dumps(conf))
try:
......@@ -477,7 +477,7 @@ def process_parse():
result = parse_header_file(target_file.resolve().as_posix(), undefined_type, error_tips)
if result != None:
target = target_file.parent.joinpath("{}.json".format(target_file.name))
with open(target.resolve().as_posix(), "w+") as f:
with open(target.resolve().as_posix(), "w+", encoding="utf-8") as f:
f.write(json.dumps(result))
result_list.append(result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment