[lazarus] CVS Updatesuy

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jun 18 12:54:56 EDT 2003


On Wed, 18 Jun 2003 18:57:47 +0200 (W. Europe Daylight Time)
Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:

>
> > The lpi only uses absolute filenames if the file is not in the project
> > directory. Can you give the full filenames?
> 
> Delphi always uses filenames relative to the project directory.
> SysUtils contains a function ExtractRelativePath() which does this for
> you.

This will will raise other problems.
For example ExtractRelativepath('/home/bla/','/tmp/some.txt') results in
'../../tmp/some.txt'. Moving the project to /home/ will not find the file
any longer.
The purpose of relative filenames is, that the project and all its files can
be transferred easily to another location. Normally this means moving the
project directory.

The ExtractRelativepath will only help, if you spread your project over
several directories:

/home/projects/projectdir/project1.lpi
/home/projects/otherdir/unit1.pas

But this is a bad idea for several reasons. If you put a unit into another
directory, then the IDE expects, that the unit is not solely part of the
project and so it does not apply all project settings to the otherdir (In
other words: find declaration will not always work).

If you want to share unit1.pas between several projects, then you should
create a package for it. If unit1.pas is not shared then it is recommended
that you save the project as 

/home/projects/project1.lpi

This way the

/home/projects/otherdir/unit1.pas

will be stored as

otherdir/unit1.pas

in the lpi file.


Mattias






More information about the Lazarus mailing list