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.
This commit is contained in:
Gatsby Van
2024-11-06 00:32:04 +08:00
parent 94aea3524e
commit caa636018b
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -437,10 +437,10 @@ _info "Working at $ws"
set config_file_id [open $config_file r] set config_file_id [open $config_file r]
set config_data [read $config_file_id] set config_data [read $config_file_id]
close $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 config [json::json2dict $config_data]
set project_name [dict get $config project_name] 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 "Starting process: $function"
_info "Project name: $project_name" _info "Project name: $project_name"
+2
View File
@@ -1,4 +1,6 @@
@echo off @echo off
cd /d "%~dp0"
set "platform=xilinx" set "platform=xilinx"
set "platform_ver=2019.1" set "platform_ver=2019.1"
set "work_dir=%~dp0build" set "work_dir=%~dp0build"