mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:49:33 +02:00
* Do not stop on invalid package-files, but show a warning + test
git-svn-id: trunk@35770 -
This commit is contained in:
parent
a9d4b17638
commit
977a82b866
@ -83,6 +83,7 @@ Resourcestring
|
||||
SLogLoadingMirrorsFile = 'Loading available mirrors from "%s"';
|
||||
SLogFindInstalledPackages = 'Searching for installed packages in "%s"';
|
||||
SLogFoundPackageInFile = 'Found package "%s" in file "%s"';
|
||||
SLogFailedLoadingPackage = 'Failed to load package "%s" in file "%s". Package is skipped. Message: %s';
|
||||
SLogFoundFPMakeAddin = 'Found FPMake-AddIn "%s"';
|
||||
SLogUpdateFPMakeAddin = 'FPMake-AddIn "%s" updated';
|
||||
SLogSavingStatusFile = 'Saving local status to "%s"';
|
||||
|
@ -31,6 +31,7 @@ type
|
||||
protected
|
||||
function GetPath: string; virtual;
|
||||
procedure SetPath(AValue: string); virtual;
|
||||
procedure AddPackageToRepository(ARepository: TFPRepository; APackageName: string; APackageFilename: string);
|
||||
public
|
||||
property Path: string read GetPath write SetPath;
|
||||
end;
|
||||
@ -106,6 +107,26 @@ begin
|
||||
FPath := AValue;
|
||||
end;
|
||||
|
||||
procedure TFPCustomFileSystemPackagesStructure.AddPackageToRepository(ARepository: TFPRepository; APackageName: string; APackageFilename: string);
|
||||
var
|
||||
P: TFPPackage;
|
||||
begin
|
||||
P:=ARepository.AddPackage(APackageName);
|
||||
try
|
||||
P.LoadUnitConfigFromFile(APackageFilename);
|
||||
P.PackagesStructure:=Self;
|
||||
log(llDebug,SLogFoundPackageInFile,[P.Name, APackageFilename]);
|
||||
if P.IsFPMakeAddIn then
|
||||
AddFPMakeAddIn(P);
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
log(llWarning,SLogFailedLoadingPackage,[APackageName, APackageFilename, E.Message]);
|
||||
P.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TFPTemporaryDirectoryPackagesStructure }
|
||||
|
||||
function TFPTemporaryDirectoryPackagesStructure.GetTempPackageName: string;
|
||||
@ -290,13 +311,7 @@ begin
|
||||
if ((SR.Attr and faDirectory)=0) then
|
||||
begin
|
||||
// Try new .fpm-file
|
||||
UF:=FpmkDir+SR.Name;
|
||||
P:=ARepository.AddPackage(ChangeFileExt(SR.Name,''));
|
||||
P.LoadUnitConfigFromFile(UF);
|
||||
P.PackagesStructure:=Self;
|
||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
||||
if P.IsFPMakeAddIn then
|
||||
AddFPMakeAddIn(P);
|
||||
AddPackageToRepository(ARepository, ChangeFileExt(SR.Name,''), FpmkDir+SR.Name);
|
||||
end;
|
||||
until FindNext(SR)<>0;
|
||||
end;
|
||||
@ -317,12 +332,7 @@ begin
|
||||
begin
|
||||
if not Assigned(ARepository.FindPackage(SR.Name)) then
|
||||
begin
|
||||
P:=ARepository.AddPackage(SR.Name);
|
||||
P.PackagesStructure:=Self;
|
||||
P.LoadUnitConfigFromFile(UF);
|
||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
||||
if P.IsFPMakeAddIn then
|
||||
AddFPMakeAddIn(P);
|
||||
AddPackageToRepository(ARepository, SR.Name, UF);
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
@ -101,7 +101,7 @@ var
|
||||
SRD : TSearchRec;
|
||||
SRF : TSearchRec;
|
||||
P : TFPPackage;
|
||||
UF,UD : String;
|
||||
UD : String;
|
||||
begin
|
||||
Result:=false;
|
||||
log(llDebug,SLogFindInstalledPackages,[Path]);
|
||||
@ -114,13 +114,7 @@ begin
|
||||
if FindFirst(UD+'*'+FpmkExt,faAnyFile,SRF)=0 then
|
||||
begin
|
||||
repeat
|
||||
UF := UD+SRF.Name;
|
||||
P:=ARepository.AddPackage(ChangeFileExt(SRF.Name,''));
|
||||
P.LoadUnitConfigFromFile(UF);
|
||||
P.PackagesStructure:=Self;
|
||||
log(llDebug,SLogFoundPackageInFile,[P.Name, UF]);
|
||||
if P.IsFPMakeAddIn then
|
||||
AddFPMakeAddIn(P);
|
||||
AddPackageToRepository(ARepository, ChangeFileExt(SRF.Name,''), UD+SRF.Name);
|
||||
until FindNext(SRF)<>0;
|
||||
end;
|
||||
FindClose(SRF);
|
||||
|
Loading…
Reference in New Issue
Block a user