How are Delphi 'environment variables' such as $(BDS) evaluated?

前端 未结 5 2156
梦谈多话
梦谈多话 2020-12-06 01:17

I\'m making some tidy installers for our internal libraries (instead of just opening the DPK\'s and clicking \'install\' and getting in a mess later...) and this has caused

5条回答
  •  有刺的猬
    2020-12-06 01:40

    I'm working on a bit of command line build automation (because I want to move away from Final Builder) so I had to deal with those special variables. To invoke the command-line compiler we're supposed to either invoke the command prompt using the "RAD Studio Command Prompt" from the Start menu, or to include the "rsvars.bat" script into our own scripts.

    That rsvars.bat script looks like this:

    @SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0
    @SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
    @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
    @SET FrameworkVersion=v2.0.50727
    @SET FrameworkSDKDir=
    @SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
    @SET LANGDIR=EN
    

    As you can notice, the very special BDS variable is set in there, as well as some others. The BDS path corresponds with the BDS installation path in the Registry, but I decided to read it from the rsvars.bat script, hoping it'll be more future-proof. So I'm essentially reading the .bat file into a TStringList and I'm applying a simple RegEx to identify the assignments.

    My routine that expands those $(Nam) style expressions includes a special case for the DELPHI name, to handle Delphi7: If I see that, I replace it with the installation path of the IDE.

提交回复
热议问题