mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 06:39:52 +02:00
Converter: Convert form files (and finish unit files) even if there was an exception during unit conversion.
git-svn-id: trunk@41485 -
This commit is contained in:
parent
da18117842
commit
7ba5e2aae9
@ -952,6 +952,7 @@ begin
|
||||
// without delay but then we must wait for the thread before continuing.
|
||||
CacheUnitsThread:=TCacheUnitsThread.Create(Self,
|
||||
TrimFilename(fSettings.MainPath+'..'+DirectorySeparator));
|
||||
try
|
||||
try
|
||||
Result:=fSettings.RunForm(CacheUnitsThread); // Get settings from user.
|
||||
if Result=mrOK then begin
|
||||
@ -970,10 +971,6 @@ begin
|
||||
|
||||
// Actual conversion.
|
||||
Result:=ConvertSub;
|
||||
EndTime:=Now;
|
||||
s:=FormatDateTime('hh:nn:ss', EndTime-StartTime);
|
||||
if s<>'00:00:00' then
|
||||
IDEMessagesWindow.AddMsg(Format(lisConvDelphiConversionTook, [s]), '', -1)
|
||||
end;
|
||||
except
|
||||
on e: EDelphiConverterError do begin
|
||||
@ -984,7 +981,13 @@ begin
|
||||
end;
|
||||
Result:=mrAbort;
|
||||
end;
|
||||
ShowEndingMessage(Result);
|
||||
finally
|
||||
EndTime:=Now;
|
||||
s:=FormatDateTime('hh:nn:ss', EndTime-StartTime);
|
||||
if s<>'00:00:00' then
|
||||
IDEMessagesWindow.AddMsg(Format(lisConvDelphiConversionTook, [s]), '', -1);
|
||||
ShowEndingMessage(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TConvertDelphiProjPack.ConvertSub: TModalResult;
|
||||
@ -1588,6 +1591,7 @@ var
|
||||
begin
|
||||
Result:=mrOk;
|
||||
ConvUnits:=TObjectList.Create;
|
||||
try
|
||||
try
|
||||
// convert all units and fix .lfm files
|
||||
IDEMessagesWindow.AddMsg('', '', -1);
|
||||
@ -1618,12 +1622,20 @@ begin
|
||||
Result:=fMainUnitConverter.fUsedUnitsTool.AddThreadSupport;
|
||||
if Result<>mrOK then exit;
|
||||
end;
|
||||
Result:=ConvertAllFormFiles(ConvUnits);
|
||||
end;
|
||||
// Finally save project once more
|
||||
Result:=LazarusIDE.DoSaveProject([sfQuietUnitCheck]);
|
||||
if Result<>mrOk then exit;
|
||||
except
|
||||
IDEMessagesWindow.AddMsg('', '', -1);
|
||||
IDEMessagesWindow.AddMsg('- '+lisConvDelphiExceptionDuringConversion, '', -1);
|
||||
raise;
|
||||
end;
|
||||
finally
|
||||
if Result=mrOk then begin
|
||||
// Try to convert FormFiles also in case of exception.
|
||||
// Unit name replacements etc. are implmented there.
|
||||
Result:=ConvertAllFormFiles(ConvUnits);
|
||||
// Finally save project once more
|
||||
Result:=LazarusIDE.DoSaveProject([sfQuietUnitCheck]);
|
||||
end;
|
||||
ConvUnits.Free; // Owns and frees converter objects.
|
||||
end;
|
||||
end;
|
||||
|
@ -5410,6 +5410,8 @@ resourcestring
|
||||
lisConvDelphiError = 'Error="%s"';
|
||||
lisConvDelphiFailedConvertingUnit = 'Failed converting unit';
|
||||
lisConvDelphiFailedToConvertUnit = 'Failed to convert unit%s%s%s';
|
||||
lisConvDelphiExceptionDuringConversion = 'Exception happened during unit conversion.'
|
||||
+' Continuing with form files of already converted units...';
|
||||
lisConvDelphiUnitnameExistsTwice = 'Unitname exists twice';
|
||||
lisConvDelphiThereAreTwoUnitsWithTheSameUnitname = 'There are two units '
|
||||
+'with the same unitname:%s%s%s%s%s';
|
||||
|
Loading…
Reference in New Issue
Block a user