IDE: Переменные: различия между версиями
(Новая: In the IDE you can define so called IDE variables. Here I will describe one good place to use such a variable. Over time most programmers, teams, companies, etc build up a set of softw...) |
(нет различий)
|
Версия 14:36, 31 октября 2007
In the IDE you can define so called IDE variables. Here I will describe one good place to use such a variable.
Over time most programmers, teams, companies, etc build up a set of software packages, which are used in many projects. Sometimes these packages are simply copied fro one project to another, but this leads to many copies of (nearly) the same software. And each time you find a bug or make an improvement you have to make it many places.
Eventually, you decide to share these packages instead of copying them. I.e. you will only have one copy of these packages on the disk. This means that the packages will lie outside the projects, rather than inside them.
You will discover that it is not a good idea to reference such shared packages by an absolute path (like c:\sharedTools\tool1\tool1.pack), because that fixates the placement on the disk, which makes restructuring of the disk difficult and in teams all team members will need an identical disk layout.
Instead you may use relative paths (like ..\sharedTools\tool1\tool1.pack), this is a little better, because now you can at least choose different top level directory (and therefore for example different disk drive).
But still the placement of the tools is locked relative to the projects, and this have some of the same drawbacks as above only a little less strong.
Using an IDE variable increase the flexibility, i.e. let us name the file $(Tools)\tool1\tool1.pack. To do this you must define the IDE variable $(Tools) and then you must make $(Tools) an include directory in the project settings.
When the include paths uses IDE Variables, the project tree will also reflect this.
If you decide to move the sharedTools to another place you can just do it and then redefine the $(Tools) variable. IDE variable are shared across all projects, so this update only has to be done once to work for all projects. Different people in a team can have the tools directory in different places, because each person have their own $(Tools) variable.
This strategy has long been used for $(ProDir) which always points to the Visual Prolog installation directory of the current compiler.