File size: 755 Bytes
e155865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import subprocess
from pathlib import Path

# 获取编译后的 texrecon 路径
def _get_texrecon_path():
    # 包内路径:pytexrecon/bin/texrecon
    bin_dir = Path(__file__).parent / "bin"
    texrecon_path = bin_dir / "texrecon"
    if texrecon_path.exists():
        return str(texrecon_path)
    raise FileNotFoundError("texrecon 未找到,请确保编译成功")

def run_texrecon(*args):
    """调用 texrecon 可执行文件,传递命令行参数"""
    texrecon_path = _get_texrecon_path()
    cmd = [texrecon_path] + list(args)
    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        raise RuntimeError(f"texrecon 执行失败:{result.stderr}")
    return result.stdout