* do not automatically register the RC reader, because it captures any file, instead handle that in fpcres itself if the output format calls for it

git-svn-id: trunk@46395 -
This commit is contained in:
svenbarth 2020-08-12 19:07:18 +00:00
parent 226ee14c20
commit bd6d1e0b6a
3 changed files with 15 additions and 6 deletions

View File

@ -127,6 +127,7 @@ begin
end;
initialization
TResources.RegisterReader('.rc',TRCResourceReader);
{ don't register automatically, as this is essentially a "catch all" }
//TResources.RegisterReader('.rc',TRCResourceReader);
end.

View File

@ -218,6 +218,7 @@ begin
sourcefiles.FileList.AddStrings(params.InputFiles);
sourcefiles.RCDefines.AddStrings(params.RCDefines);
sourcefiles.RCIncludeDirs.AddStrings(params.RCIncludeDirs);
sourcefiles.RCMode:=CurrentTarget.objformat=ofRes;
try
sourcefiles.Load(resources);
except

View File

@ -39,6 +39,7 @@ type
fRCIncludeDirs: TStringList;
fRCDefines: TStringList;
fStreamList : TFPList;
fRCMode: Boolean;
public
constructor Create;
destructor Destroy; override;
@ -46,6 +47,7 @@ type
property FileList : TStringList read fFileList;
property RCIncludeDirs: TStringList read fRCIncludeDirs;
property RCDefines: TStringList read fRCDefines;
property RCMode: Boolean read fRCMode write fRCMode;
end;
implementation
@ -61,6 +63,7 @@ begin
fStreamList:=TFPList.Create;
fRCDefines:= TStringList.Create;
fRCIncludeDirs:= TStringList.Create;
fRCMode:=False;
end;
destructor TSourceFiles.Destroy;
@ -92,11 +95,15 @@ begin
raise ECantOpenFileException.Create(fFileList[i]);
end;
fStreamList.Add(aStream);
try
aReader:=TResources.FindReader(aStream);
except
raise EUnknownInputFormatException.Create(fFileList[i]);
end;
{ the RC reader reads anything, so handle that separately }
if fRCMode then
aReader:=TRCResourceReader.Create
else
try
aReader:=TResources.FindReader(aStream);
except
raise EUnknownInputFormatException.Create(fFileList[i]);
end;
Messages.DoVerbose(Format('Chosen reader: %s',[aReader.Description]));
try
Messages.DoVerbose('Reading resource information...');