[lazarus] CVS Updatesuy

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Wed Jun 18 13:36:17 EDT 2003




On Wed, 18 Jun 2003, Mattias Gaertner wrote:

> 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

I suppose that 99% of all projects will be one directory containing
the project file, and all other files in directories. Lazarus itself
is such a project.

So for 99% of all cases, using the relative path helps in keeping your
project moveable.

This is useful for instance if you have 2 branches in CVS. If you check out
the branches in different directories
/home/me/projects/myproject (+ subdirs)

Check out two copies, one for each branch:
/home/me/projects/myproject-main
/home/me/projects/myproject_fixes

If you keep relative paths, this will work. With absolute paths, you must
rename all files.

I think that keeping relative paths is a solution. If you use files totally
outside the project dir, then the IDE can simply store the absolute path.
But all subdirectories should be as relative paths. It is a small check to
do this, finally. If extractrelativepath starts with .., just use the
absolute path.  In all other cases, use the relative path.

Michael.







More information about the Lazarus mailing list