[lazarus] Corrupted LPI

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Sep 30 07:46:42 EDT 2002

On Fri, 27 Sep 2002 09:23:55 -0400
"Andrew Johnson" <aj_genius at hotmail.com> wrote:

> On Thu, 26 Sep 2002 19:48:23 -0400
> "Michael A. Hess" <mhess at miraclec.com> wrote:
> >Hmmm. Interesting feature but can this cause problems in some cases. For 
> >example: Tony provided the source for the checkbook project. I opened the 
> >.lpi and notice, as he did, that it had listings for all sorts of files 
> >that had been opened and looked at. The problem is that I don't have those 
> >files at the same location (path) that he does. I think that was one 
> >problem I had when initially opening his project. He had left the project 
> >in a state where he had opened some FPC source files and left them opened 
> >in the editor. Those same files tried to open on my machine but they aren't 
> >in the same location. The project had a problem opening. (At least I think 
> >that is what was going on.)
> >So is this a possible problem or was something else going on?
> Yes. This is a very likely problem. Fact is, I think that lpi's should only 
> contain Project file information, and Currently Open File information. 

There is already an option for this:
Project -> Project Options -> Info -> Save editor info for closed files

The other option on the same page can be used for published projects. 
But I think this is not very comfortable for the purposes mentioned.
I will add a 'publish project' menu item and add some global options to put information about closed files into a global file.

> Basically I think that Lazarus should have another xml file which stores 
> info on all files ever opened in one central location. This would ensure 
> smaller lpi

It is planned that the closed files in the lpi files get 'usage stamps'. When a file is not used for a long period of time, the IDE will automatically remove them from the project.

> and if lpi's made sure to store relative location's of project 
> files (../myfiles/myfile.pas, vs /somedir/someproj/myfiles/myfile.pas)

Aehm, this is already the case. If not then you have spotted a bug. Can you describe me an example?

> and we had a "Publish Project" option which stripped any non-Project Info from 
> the file(non-project open files), 

See above. The only missing thing is to set the default for all projects.

> I think we would be much better off when 
> it comes to sending projects to other people etc. 

See above. I think there are two cases:
Projects that are always published (like the gtkglarea example in the laz sources)
and projects that should be sent to other people on occasion.
The former can be done with the two existing options and the latter with a 'publish project' function.
What do you/the others think?

> Also we should have a 
> command somewhere to clean out the lazarus xml of non-existing entries(if 
> not file exists delete entries) to clean out the garbage. 

ok. This can easily be done when the auto deletion is implemented.

> I was actually 
> planning on asking Mattias about this later on, because while I hadn't 
> considered the aspect of different systems different locations, why should 
> we duplicate al these entries in multiple project files? 

Think of the following scenario:
You have several lcl projects. In project A you are currently searching a bug, so you have opened a lot of lcl+gtk files showing related places in the sources. Then time runs out and you have to work on project B. So, you open this one and do some work. When you come back to poject A, you don't want to waste time to find all the places where you were. Because the complete session information is saved in the lpi file you can continue instantly. 
Another reason is the 'where did I stop last time' question. If I have not worked several days/weeks on a project, I always need some time to find out, what I was working at. But with the complete session of a project, seeing all the files at the last working position, I remember much faster.

> And I have always tried to make sure of 
> relative paths in Delphi because what happens if I move a project folder and 
> try and reopen the Project? I have to remove and re-add all the files with 
> non-relative paths.

If you have ideas how to turn more absolute paths to relative ones, plz tell me.


More information about the Lazarus mailing list