Controlling your Library Path can be beneficial for a number of reasons: easier reading, sharing network components/libraries, or even escrowing projects.
There is a relatively straightforward way to control the many component libraries we have available for our use in Delphi.
An example of this syntax can be seen at the top of the Delphi Library Path dialog, as shown below:
This $(DELPHI) syntax can easily be replicated for our own use. For example, I try to keep my components very tightly version controlled and all in one directory. My reason for this approach is a nasty past experience: building an escrow for a customer was a painful task to build, test, and maintain.
However, this neat-freak approach helps us maintain the Library entries easily.
So what is this $(DELPHI) comment? Well, it is a reference to an environment variable. As such, we can create our own reference by right-clicking My Computer, selecting Properties, and selecting the Advanced tab. On this tab, we can see a section relating to Environment Variables.
If you click the Environment Variables button, you can see a list of the variables currently used on the system.
To help me organise my Library Path, I created a variable called COMN_COMP, which I pointed to the directory in which all my main components reside.
From this point, we can start Delphi and use $(COMN_COMP) to replace that common path information in all the directory listings. This can shorten the strings listed in the Library Path.
However, that isn't the major benefit as I see it. The major benefit is that the information now held in the Registry key that represents the Library Path is very portable. You can copy this registry value, store it in a .reg file, and import it into a test machine. Configure the environment variable, and you are almost up and running.
The same trick can be used with the Known IDE Packages registry key, so you can even specify the packages to be loaded in exactly the same way. In fact, this is the approach Delphi itself uses to load the core IDE packages for the components that come with Delphi, as can be seen in the appropriate registry key:
It also really helps when you have to recover from a system failure and need to get up and running very quickly again.
As most of us IT people tend to neglect backups for our own data, this might be helpful to any serious Delphi Developer. ;)
Tidy component library for easy migrations or builds
Tidy component library for easy migrations or builds : Multi-thousand tips to make your life easier.
Controlling your Library Path can be beneficial for a number of reasons: easier reading, sharing network components/libraries, or even escrowing projects.
There is a relatively straightforward way to control the many component libraries we have available for our use in Delphi.
An example of this syntax can be seen at the top of the Delphi Library Path dialog, as shown below:
This $(DELPHI) syntax can easily be replicated for our own use. For example, I try to keep my components very tightly version controlled and all in one directory. My reason for this approach is a nasty past experience: building an escrow for a customer was a painful task to build, test, and maintain.
However, this neat-freak approach helps us maintain the Library entries easily.
So what is this $(DELPHI) comment? Well, it is a reference to an environment variable. As such, we can create our own reference by right-clicking My Computer, selecting Properties, and selecting the Advanced tab. On this tab, we can see a section relating to Environment Variables.
If you click the Environment Variables button, you can see a list of the variables currently used on the system.
To help me organise my Library Path, I created a variable called COMN_COMP, which I pointed to the directory in which all my main components reside.
From this point, we can start Delphi and use $(COMN_COMP) to replace that common path information in all the directory listings. This can shorten the strings listed in the Library Path.
However, that isn't the major benefit as I see it. The major benefit is that the information now held in the Registry key that represents the Library Path is very portable. You can copy this registry value, store it in a .reg file, and import it into a test machine. Configure the environment variable, and you are almost up and running.
The same trick can be used with the Known IDE Packages registry key, so you can even specify the packages to be loaded in exactly the same way. In fact, this is the approach Delphi itself uses to load the core IDE packages for the components that come with Delphi, as can be seen in the appropriate registry key:
It also really helps when you have to recover from a system failure and need to get up and running very quickly again.
As most of us IT people tend to neglect backups for our own data, this might be helpful to any serious Delphi Developer. ;)