From 47bb9119ddb1365419c5671f3eb743b1cfce299e Mon Sep 17 00:00:00 2001 From: Gatsby Date: Tue, 29 Oct 2024 14:26:26 +0800 Subject: [PATCH] fix(platform/xilinx): fallback to `mklink` for file symlink creation on Windows --- platform/xilinx/util.tcl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/platform/xilinx/util.tcl b/platform/xilinx/util.tcl index cfa5693..ca8864d 100644 --- a/platform/xilinx/util.tcl +++ b/platform/xilinx/util.tcl @@ -125,7 +125,21 @@ proc _handle_sources {app_name sources} { switch $link_srcs { "y" { # Create symbolic link - file link -symbolic $target_path $eval_source + # -- TCL cannont create symbolic link for files on Windows + # -- Fallback to use mklink command + if {$::tcl_platform(platform) eq "windows" && ![file isdirectory $eval_source]} { + if {[catch { + exec cmd /c mklink [file nativename $target_path] [file nativename $eval_source] + } err]} { + error "Failed to create file symbolic link using mklink: $err" + } + } else { + if {[catch { + file link -symbolic $target_path $eval_source + } err]} { + error "Failed to create symbolic link: $err" + } + } _info "Created symbolic link: $target_path -> $eval_source" } "n" {