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 me to have to understand how to get at various Delphi variables such as Known Packages, the registry RootDir value etc.
I see that within Delphi there are a number of variables that you can use (within a search path for example) such as $(BDS) etc. When I look into my machine environment variables I dont see these, either in system or current user.
My questions are:
The value for $(BDS) is found in: HKCU\Software\<Borcadero>\BDS\<version>\RootDir .
On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.
1) They are simply environment variables which Delphi sets for its own process and you can retrieve them with GetEnvironmentStrings from a design package installed in the IDE; here's an example.
If your installer is a separate executable, you can still (more or less reliably) guess where to get some of the values:
BDS
: RootDir
value in the registry, e.g. HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\8.0\
BDSCOMMONDIR
: in older versions (Delphi 2007, I guess) this was a global environment variable, set by the Delphi installer. In later versions you can find it in rsvars.bat
.Some others might probably be derived, e.g.:
BDSLIB
: $(BDS)\lib
BDSINCLUDE
: $(BDS)\include
User-defined variables (defined in Delphi's Environment Options dialog) are stored in the Environment Variables
registry subkey.
2) The $(...)
notation is IMHO simply better because it has distinct opening and closing delimiters, it's easier to work with for search/replace operations and also more readable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With