scripts/adi_env.tcl: helper function for environment variables

Ease the access of the environment variables.
main
Laszlo Nagy 2020-02-07 10:48:47 +00:00 committed by Laszlo Nagy
parent 1b0a47c101
commit 1f7671cb36
1 changed files with 14 additions and 0 deletions

View File

@ -15,3 +15,17 @@ if [info exists ::env(ADI_GHDL_DIR)] {
set ad_ghdl_dir [file normalize $::env(ADI_GHDL_DIR)] set ad_ghdl_dir [file normalize $::env(ADI_GHDL_DIR)]
} }
# This helper pocedure retrieves the value of varible from environment if exists,
# other case returns the provided default value
# name - name of the environment variable
# default_value - returned vale in case environment variable does not exists
proc get_env_param {name default_value} {
if [info exists ::env($name)] {
return $::env($name)
} else {
return $default_value
}
}