From e8a1e869cb544b279f6a002fb1fc3d1e6def44fd Mon Sep 17 00:00:00 2001 From: Gatsby Van Date: Mon, 4 Nov 2024 20:21:32 +0800 Subject: [PATCH] refactor: set reference directory to current working directory --- platform/xilinx/util.tcl | 4 ++-- template.bat | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/xilinx/util.tcl b/platform/xilinx/util.tcl index 963be15..8ae5852 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 93837b5..ec7ce4d 100644 --- a/template.bat +++ b/template.bat @@ -5,6 +5,9 @@ set "work_dir=%~dp0build" set "config=%~dp0config.json" set "tools_dir=%~dp0scripts\platform\%platform%" +REM Change working dir to the dir where this script is located +cd /d "%~dp0" + REM Set up enviroment call "%tools_dir%\setenv.bat" "%pltform_ver%" if "%ERRORLEVEL%" neq "0" (