Error with environment variable in Delphi

In Delphi, I can pick up environment variable %FOO% as $(FOO).  I can then use $(FOO) in the library path for Delphi.

Sometimes, in the Delphi IDE, I want to remove part of the search path that has $(FOO) in it, so I change the path to read $( FOO) (i.e., put a space in front of FOO).  Delphi then doesn't find that path, and proceeds to ignore it.

FB5, however, complains in this case, and says it can't find FOO (actually, it's saying FOO but the is not visible).  I think such variables should be ignored in FB too.

Comments?

Hi Jim,

Thanks for your post.

The catch here is that FinalBuilder has a little-known feature which allows you to specify FB variables as $(VarName) as well as %VarName%, so it's trying to find the variable named " FOO" in order to expand it before passing it to the Delphi action. This will happen when you specify the variable name inside the FinalBuilder project options (rather than inside the Delphi project file.)

Having FB ignore such failures is not really an option because most of the time people need to validate that their variables actually exist.

Here are some suggestions:

1) Specify the variable as $$( FOO). FB expans $$(XX) to $(XX) at runtime, so Delphi will see the argument as $( FOO) and probably ignore it.

2) Define a FinalBuilder Project Variable called "MyFoo" and use the Set Variable action to set it to the value of Environment Variable "Foo". Use MyFoo in place of Foo in the Delphi action. To disable the variable, just disable the Set Variable action, so the project variable has an empty value.

3) Specify the environment variables inside the Delphi configuration files, and set the Delphi action to use the values from the configuration files instead of values from the action properties.

Hth.

Regards,

Angus