[Lazarus] Criteria to add/remove UnitName from project (lpi) file

luiz americo pereira camara luizmed at oi.com.br
Sun Mar 22 21:44:35 CET 2015

2015-03-22 16:59 GMT-03:00 luiz americo pereira camara <luizmed at oi.com.br>:

> 2015-03-22 16:32 GMT-03:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>> On Sun, 22 Mar 2015 10:15:23 -0300
>> > http://imagebin.ca/v/1vhYYNAJuxPx : Here two files have UnitName added
>> in
>> > lpi
>> >
>> > http://imagebin.ca/v/1vhYLsrfpWDd : One commit later, the same files
>> have
>> > UnitName removed
>> >
>> > Is this a bug ?
>> Probably. Do you know how to reproduce it?
Found something that may be related:

Take the following entry:

        <Filename Value="views\mainview.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="MainViewForm"/>
        <HasResources Value="True"/>
        <ResourceBaseClass Value="Form"/>

In TUnitInfo.LoadFromXMLConfig:

A Filename is set to  FileName ('views\mainview.pas')

Later AFileName is set again this time to ResourceFileName, that is empty

Later AFilename is checked before setting fUnitName:
if FilenameIsPascalSource(AFilename) then


Since AFileName is empty, fUnitName will not be set

In the other side, in the following file

        <Filename Value="models\patientclasses.pas"/>
        <IsPartOfProject Value="True"/>
        <UnitName Value="PatientClasses"/>

fUnitName is set to empty at LoadFromXMLConfig, but at the time of saving
fUnitName gets its correct value 'PatientClasses'. Could not detect where
gets the correct value. Breakpoints  at ImproveUnitNameCache, SetUnitName,
ReadUnitSource and LoadFromXMLConfig

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150322/058f6367/attachment-0003.html>

More information about the Lazarus mailing list