views:

358

answers:

5

Hey Everyone,

I've got what I'm hoping is a simple question. In the Delphi IDE, the path to the Delphi installation is specified as $(DELPHI). I am wondering if there is a way to create my own path indicators, such as $(MY_LIBRARY) or something similar. I thought $(DELPHI) was specified as an environment variable, but apparently not. Any ideas? (I'm using Delphi 5)

Thanks all!

~DJ

DJ Quimby

+6  A: 

In Delphi 2010:

  • select Tools -> Options
  • select "Environment Variables"
  • specify either System, either User variable
da-soft
Thanks for the response. I should have specified that I am using Delphi 5, 7, and 2010. It is Delphi 5 that I am trying to do this in. Sorry about that
DJ Quimby
Delphi 5 does not support user-defined environment variables. That was introduced in Delphi 6.
Remy Lebeau - TeamB
Thanks Remy. I'll reserve that as just another reason to update all this code to 7 or 2010!
DJ Quimby
A: 

In Delphi 2010: I know many of the XML tags in the Project.dproj can be used like this. (For exemple, $(DCC_DcuOutput), $(DCC_ExeOutput)...).

Maybe it is possible to add your own XML tags in the file and use them afterward. Though I'm not sure if they'll be preserved by the IDE.

Ken Bourassa
A: 

Also of note is when your using the command line compiler, the file RSVARS.BAT located in the BIN directory of the current Delphi installation is what creates some of the environment variables for child processes. (for example BDS and BDSCOMMONDIR).

skamradt
A: 

In Windows 7 (and Vista is similar) click the 'start' button, right-click 'computer', 'properties' and then 'advanced system settings'. Click 'Environment variables' and you're now able to create new ones as global (system), or just for the current user (you). For example 'MyVar'.

Now in a delphi path, refer to MyVar as $(MyVar).

MyVar will now be visible in batch files too as %MyVar%.

Brian Frost
+1  A: 

For Delphi 5 you can add them from windows Environment variables

right click on My computer > properties > advanced > Environment variables

Mohammed Nasman
I did the following: Added system variable with the following info: Variable Name: OUTPUT_DIR Variable Value: T:\Builds And in Delphi, in the Output folder: $(OUTPUT_DIR)\Projects\BplThis generates the error: Could not create output file $(OUTPUT_DIR)\Projects\Bpl\Amase32.exe
DJ Quimby
You can add as many environment variables as you want, but it won't make any difference. Delphi 5 doesn't recognize environment variables. `$(DELPHI)` is not an environment variable.
Rob Kennedy
Rob, that is correct, as I had indicated I discovered in my original question. That said, is there any way to mimic the way ($DELPHI) is used in my own Delphi 5 projects?
DJ Quimby