4
votes

I followed the advice received in a previous discussion ( Should "Library path" point to the source files of packages? ) and now my Library Path points to folders containing the compiled code (DCU) and NOT to the source code of my controls. The problem is that I have to duplicate the RES and DFM files and copy them from the 'source code' folder to the 'compiled' folder. It is not a elegant solution at all since, every time I change something (and I do often) to my controls I have to remember to copy the new resource files to the compiled folder.

There must be an elegant way to solve the mystery of the paths! All I want is to push the compile button and to have my program compiled. It doesn't seem so complicated. Right? Well, actually it work with my previous setup (point Delphi to source code of all controls). I just changed it to do it the way the 'good people' are doing it.

Addendum
I still think this is the wrong approach since Delphi's (scarce) documentation says that Library path should point to the "source files for the package".


Using:
Delphi 7, Win 7 (32), simple Delphi setup (single developer with no versioning system installed).

3
versioning systems are very useful for single developers as well. I'd recommend you to use one because 1) It will make working with different version of your code easier 2) It will protect you from your onwn mistakes 3) You will learn how to use oneuser160694

3 Answers

2
votes

You have two solution:

  1. Use a build tool to build and copy all files where they should be properly deployed (my preferred solution) after each build
  2. Put the .pas/.dfm/.res directory after the .dcu ones. It will find the .dcu first and won't recompile unless you build, and it will keep on looking for .res/.dfm, etc.
1
votes

If you look inside a D2007 project file (*.dproj) you'll see that the search path occurs multiple time for each configuration. There is

  • <DCC_UnitSearchPath>,
  • <DCC_ResourcePath>,
  • <DCC_ObjPath> and
  • <DCC_IncludePath>.

Maybe you can point <DCC_ResourcePath> to the source directory containing the resource files while you point the other variables to the DCU directory.

NB: I haven't tried this and can't check if the situation is different in other Delphi versions.

0
votes

Though answers provided here by others are definitively good and correct (everybody receives a vote up), after experimenting a bit I decided to keep my previous (KISS) set up. It worked for years and it will work for many more. I know, it trades speed (recompiling the source code) for stability but it keeps the "paths, libraries, source, browsing and output folders" madness at bay. I just don't have to worry about settings paths anymore (except first time when I install Delphi but this can be automated) or to quit current DPR Delphi project and load a DPK library and compile it every time I add changes to it.