mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 09:36:09 +02:00
IDE: Check Filename<>UnitName mismatch only when Codetools was able to parse the source. Issue #22921.
This commit is contained in:
parent
3e382c4b5b
commit
7cb38d7bc6
@ -89,13 +89,15 @@ begin
|
||||
// valid unitname
|
||||
Unit_Name:='';
|
||||
CodeBuffer:=CodeToolBoss.LoadFile(AFilename,true,false);
|
||||
if CodeBuffer<>nil then
|
||||
if CodeBuffer<>nil then begin
|
||||
Unit_Name:=CodeToolBoss.GetSourceName(CodeBuffer,false);
|
||||
if CompareText(Unit_Name, AUnitFilename)<>0 then
|
||||
if IDEMessageDialog(lisA2PInvalidUnitName,
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer,[Unit_Name,LineEnding,AUnitFilename]),
|
||||
mtError,[mbIgnore,mbCancel]) <> mrIgnore
|
||||
then exit;
|
||||
// Unit_Name can be empty if Codetools had problems parsing the source.
|
||||
if (Unit_Name<>'') and (CompareText(Unit_Name, AUnitFilename)<>0)
|
||||
and (IDEMessageDialog(lisA2PInvalidUnitName,
|
||||
Format(lisA2PTheUnitNameAndFilenameDiffer,
|
||||
[Unit_Name,LineEnding,AUnitFilename]),
|
||||
mtError,[mbIgnore,mbCancel]) <> mrIgnore) then exit;
|
||||
end;
|
||||
|
||||
if not IsValidUnitName(AUnitFilename) then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user