更改文件
This commit is contained in:
@ -44,7 +44,7 @@ async def _(downloaded: bool):
|
||||
global bin_path
|
||||
|
||||
tar_path = arti_typst_linux.target
|
||||
bin_path = tar_path.with_name("typst")
|
||||
bin_path = BINARY_PATH / "typst"
|
||||
|
||||
if downloaded or not bin_path.exists():
|
||||
bin_path.unlink(missing_ok=True)
|
||||
@ -96,6 +96,8 @@ TEMPLATE = TEMPLATE_PATH.read_text()
|
||||
|
||||
|
||||
def render_sync(code: str) -> bytes | None:
|
||||
global bin_path
|
||||
|
||||
if bin_path is None:
|
||||
return
|
||||
|
||||
@ -153,10 +155,13 @@ async def _(
|
||||
msg: UniMsg,
|
||||
target: DepLongTaskTarget,
|
||||
):
|
||||
global bin_path
|
||||
|
||||
# 对于本地机器,一般不会在应用启动时自动下载,这里再保证存在
|
||||
await ensure_artifact(arti_typst_linux)
|
||||
await ensure_artifact(arti_typst_windows)
|
||||
if bin_path is None:
|
||||
if bin_path is None or not bin_path.exists():
|
||||
logger.warning("当前环境不存在 Typst,但仍然调用了")
|
||||
return
|
||||
|
||||
typst_code = ""
|
||||
|
||||
Reference in New Issue
Block a user