[Lazarus] Project Groups are saving LPI files

Ondrej Pokorny lazarus at kluug.net
Thu Aug 15 13:43:58 CEST 2019


Hello (Mattias)!

Project groups are saving my LPI files upon loading the project group. 
This is a problem because they resave LPIs without BOM and then all LPIs 
are marked as modified in SVN because they were saved with BOM. (Lazarus 
IDE saves my project files with BOM.)

I searched the reason and found out that TXMLConfig is the problem. 
There are 2 issues:

1.) TXMLConfig should keep the original encoding along with BOM.
2.) Project groups should never save LPIs.

About 2.:
The problem is:
constructor TXMLConfig.CreateClean(const AFilename: String);
begin
   //DebugLn(['TXMLConfig.CreateClean ',AFilename]);
   fDoNotLoadFromFile:=true;
   Create(AFilename);
   FModified:=FileExistsCached(AFilename);
end;

FModified gets True here - why? Is there a reason why the config should 
be set as Modified on create and consequently be resaved on Free when 
FileExistsCached returns true?

Setting the Modified flag to False in TIDECompileTarget.LoadProject 
before xml.Free is definitely a fix but IMO it should be fixed within 
TXMLConfig.

---
The above code could be a cause for another problem as well - when the 
currently open LPI project file is modified externally (e.g. SVN 
update), Lazarus IDE asks to reload the project but sometimes the LPI 
file is rewritten by the IDE and the new external changes get lost. I 
experienced this issue before installing Project groups but could not 
find clear steps-to-reproduce and could not find the reason for it.

Ondrej



More information about the lazarus mailing list