1.3.36 $UNITPATH : Specify unit path.

This option serves to specify the unit path, where the compiler looks for unit files. {$UNITPATH XXX} will add XXX to the unit path. XXX can contain one or more paths, separated by semicolons or colons.

For example:

{$UNITPATH ../units;../i386/units}  
 
Uses strings;

will add the directories ../units and ../i386/units to the unit path of the compiler: these directories are relative to the unit file in which the directive appears. The compiler will look for the file strings.ppu in both these directories, and will link the first found file in the program. This directive is equivalent to the -Fu command line switch.

Caution is in order when using this directive: If you distribute files, the locations of the files may not be the same as on your machine; moreover, the directory structure may be different. In general it would be fair to say that you should avoid using absolute paths, instead use relative paths, as in the example above. Only use this directive if you are certain of the locations where the files reside. If you are not sure, it is better practice to use makefiles and makefile variables.

Note that this switch does not propagate to other units, i.e. its scope is limited to the current unit (this is in line with the fact that the paths are relative to the current unit.)

The uses clause construct uses a in ’sub/a.pp’ is relative to the current working directory of the compiler. By adding a directive to your program:

{$UNITPATH sub}  
 
uses a in 'sub/a.pp';

you will make sure the compiler will always find the sources.