fix: use tempfile.gettempdir() instead of hardcoded /tmp/ for JTAG TCL file

/tmp/ doesn't exist on Windows — Path('/tmp/...') resolves to C:\tmp\ which
fails with 'No such file or directory'. Use tempfile.gettempdir() for
cross-platform temp directory resolution.

Also cleaned up the get_vivado_path() call (removed obsolete vitis_path kwarg).
This commit is contained in:
2026-06-11 15:36:04 +08:00
parent 17c8f2d68b
commit 267cae93b6
+2 -2
View File
@@ -11,6 +11,7 @@ from __future__ import annotations
import os import os
import re import re
import subprocess import subprocess
import tempfile
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import Callable from typing import Callable
@@ -88,7 +89,6 @@ def check_zynq_jtag(config: Config, callback: Callable | None = None) -> ZynqChe
# Find vivado executable via Xilinx root scan # Find vivado executable via Xilinx root scan
vivado_path = get_vivado_path( vivado_path = get_vivado_path(
vitis_path=getattr(config, "vitis_path", ""),
xilinx_root=getattr(config, "xilinx_path", ""), xilinx_root=getattr(config, "xilinx_path", ""),
) )
if not vivado_path: if not vivado_path:
@@ -104,7 +104,7 @@ def check_zynq_jtag(config: Config, callback: Callable | None = None) -> ZynqChe
# Create temporary TCL script # Create temporary TCL script
tcl_content = _build_jtag_query_tcl() tcl_content = _build_jtag_query_tcl()
tcl_path = Path("/tmp/zynq_jtag_check_{}.tcl".format(os.getpid())) tcl_path = Path(tempfile.gettempdir()) / f"zynq_jtag_check_{os.getpid()}.tcl"
try: try:
tcl_path.write_text(tcl_content) tcl_path.write_text(tcl_content)