Rev. 24.1.15, 10 July 2024

4.11 Environment Variables

To define an environment variable you can use the following syntax:





To use the value of an environment variable called ENV_VAR you can use any of the following notations:

  • UNIX: $ENV_VAR or ${ENV_VAR}

  • Windows: %ENV_VAR%

  • Makefile: $(ENV_VAR)

  • TCL: $::env(ENV_VAR) or $env(ENV_VAR)

Environment variables, either from the parent shell or explicitly defined, can be used to specify:

  • top files

  • directives that take a path as an argument, for example +incdir+

  • value for defines

When an environment variable is not defined, but it is used, the behavior is as follows:

  • for the value of a define directive, the define value is left as-is

  • for top files and directives that take a path as an argument, an error is signaled and such top files and directives are ignored

  • when used inside the value of an environment variable, it is expanded to the empty string

Environment variables are visible to the DVT parsers, for example when used in the e language import statements.

Environment variables are propagated to the external tools launched from DVT, for example by using Run Configurations or External Builders.

When an environment variable is used inside a build file, only the +dvt_setenv+ directives above the usage line are taken into account.

Implementation note

The Dot '.' segment in a path denotes the current directory, which is solved when the path is used, for example to specify a top file or incdir. It is not solved when defining an environment variable. See the example below:

-------- In default.build --------
+dvt_setenv+MYVAR=.   // $MYVAR has the value '.' until used to specify a path
$MYVAR/top1.e         // Equivalent with $DVT_PROJECT_LOC/top1.e
-F other/file.f

-------- In other/file.f --------
                      // $MYVAR is used here to specify a path, '.' shall be solved to $DVT_PROJECT_LOC/other/
$MYVAR/top2.e         // Equivalent with $DVT_PROJECT_LOC/other/top2.e

Predefined environment variables

Variable Value
DVT_PROJECT_LOCAbsolute path of the project directory.