[lazarus] CVS Updatesuy

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jun 18 19:26:14 EDT 2003


On Wed, 18 Jun 2003 20:46:27 +0200 (CEST)
Michael.VanCanneyt at wisa.be wrote:

> 
> 
> On Wed, 18 Jun 2003, Mattias Gaertner wrote:
> 
> > On Wed, 18 Jun 2003 20:08:10 +0200 (CEST)
> > Michael.VanCanneyt at wisa.be wrote:
> >
> > >
> > >
> > > 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.
> >
> > ?
> > Is this not the same as simply cutting the project directory from the
> > filename?
> 
> ? Actually, yes it is :-)
> 
> But if I understood correctly, now complete filenames are used ?

The IDE cuts the project directory from the filenames, before saving the
lpi. I don't know why Marco has some files, that were not cut. It seems, the
unit was not in the project directory, as he saved. But why?


Mattias






More information about the Lazarus mailing list