[Lazarus] Project Groups are saving LPI files

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Aug 17 16:53:50 CEST 2019


On Thu, 15 Aug 2019 13:43:58 +0200
Ondrej Pokorny via lazarus <lazarus at lists.lazarus-ide.org> wrote:

>[...]
> Project groups are saving my LPI files upon loading the project
> group.

Huh? Do you really mean, merely opening a lpg touches some lpi files?


> 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?

TXMLConfig.CreateClean;
TXMLConfig.Flush; -> should write, so needs Modified=true

Maybe it is a bad idea to auto flush on Destroy.

Mattias


More information about the lazarus mailing list