FB7.0.0.515 / FB6.3.0.2026 / Windows XP Professional SP3
Hi there!
I have attached an example project enviroDemo.zip to demonstrate the issue.
It appears Project Variables with attributes "Make Env" and "Is Macro" - DIR_RESTORED_REPOSITORY here - may not be evaluated properly when accessed from the environment in a subsequent batch file, enviroDemo.bat.
The batch file echoes the variable DIR_RESTORED_REPOSITORY as:
1) extracted from the batch file's environment
2) passed in via a command-line argument , %1, to the batch file
DIR_RESTORED_REPOSITORY (=%DIR_RESTORED ROOT%\Repository) relies on another project variable, DIR_RESTORED ROOT, that is loaded from an INI file as the first action of the script.
Case 2 above is the expected value. It appears that Case 1 is the value of DIR_RESTORED_REPOSITORY as evaluated _before_ the script begins, i.e. before the value of DIR_RESTORED ROOT is read from the INI file.
Perhaps a variable with both attributes "Make Env" and "Is Macro" is only injected into the environment at the start of a script, rather than at each macro evaluation, or before each action?
The reality is that we should have not allowed both options to be enabled together. Variables set to “Make Env” only set the environment variable when they are themselves set, and in the case of Macro variables, that only happens when the variable is reset at the start of the build. Setting them again at the start of every action is not practical, and would slow down some builds (we see users project files with hundreds of variables!).
What I have done for the next build, is that every time a “macro & env” variable is evaluated, it will set the environment variable. That still doesn’t help your example project, however using this scenario, I added a log variables action before the run dos command, and it then worked as desired. A bit of a kludge I guess, but usable none the less.
We’ll be posting a new build shortly, just testing some other fixes.