Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you deal with IFDEFs in .dpr uses section

Tags:

delphi

Whenever you add a new unit to the project Delphi rebuilds the .dpr file and all the IFDEFs in the uses section are gone.

To work around this I typically use NotePad to create new .pas files, and add it to the .dpr manually. If I need a form I use File->New->Form and then revert the .dpr file to the previous version. Not very RAD if you ask me ;-)

How do you deal with that? Is there a way to add a unit in the IDE while keeping the IFDEFs?

like image 914
Giel Avatar asked Apr 16 '09 21:04

Giel


2 Answers

Sometimes I create a unit specifically as a place for all the IFDEFs and other stuff the IDE would mess up if it were in the dpr. This unit typically goes to the top of the dpr's uses clause. This trick doesn't cater for all scenarios but it sometimes saves a lot of tedious work.

like image 135
Uli Gerhardt Avatar answered Oct 21 '22 22:10

Uli Gerhardt


I don't put any ifdefs into a dpr file. If I want to use different units/forms in a project, depending on some condition, I split the project in two.

like image 3
dummzeuch Avatar answered Oct 21 '22 20:10

dummzeuch