From caa636018b1e81b7c3f7c3d3d68f01f9fcd92064 Mon Sep 17 00:00:00 2001 From: Gatsby Van Date: Wed, 6 Nov 2024 00:32:04 +0800 Subject: [PATCH] refactor: make paths relative to current working directory - Allows configuration files to be placed in separate folders, with paths in config files now relative to the config file's location. - Added `cd /d "%~dp0"` at the beginning of the `.bat` template to ensure paths are based on the script's location, enhancing portability and consistency. --- platform/xilinx/util.tcl | 4 ++-- template.bat | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/xilinx/util.tcl b/platform/xilinx/util.tcl index 963be15..d548f6e 100644 --- a/platform/xilinx/util.tcl +++ b/platform/xilinx/util.tcl @@ -437,10 +437,10 @@ _info "Working at $ws" set config_file_id [open $config_file r] set config_data [read $config_file_id] close $config_file_id -set root [file dirname [file normalize $config_file]] +set root [pwd] set config [json::json2dict $config_data] set project_name [dict get $config project_name] -set hw_file [file normalize [file join [file dirname $config_file] [dict get $config hw_design]]] +set hw_file [file normalize [file join $root [dict get $config hw_design]]] _info "Starting process: $function" _info "Project name: $project_name" diff --git a/template.bat b/template.bat index 66f2a49..d3b1c29 100644 --- a/template.bat +++ b/template.bat @@ -1,4 +1,6 @@ @echo off +cd /d "%~dp0" + set "platform=xilinx" set "platform_ver=2019.1" set "work_dir=%~dp0build"