Selaa lähdekoodia

* Option to warn about not found resource files instead of error

Michaël Van Canneyt 1 vuosi sitten
vanhempi
commit
b245f2deb1
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      packages/fcl-passrc/src/pscanner.pp

+ 7 - 3
packages/fcl-passrc/src/pscanner.pp

@@ -730,7 +730,8 @@ type
     po_AsyncProcs,            // allow async procedure modifier
     po_DisableResources,      // Disable resources altogether
     po_AsmPascalComments,    // Allow pascal comments/directives in asm blocks
-    po_AllowMem              // Allow use of meml, mem, memw arrays
+    po_AllowMem,              // Allow use of meml, mem, memw arrays
+    po_WarnResourceNotFound // Do not raise error if resource not found.
     );
   TPOptions = set of TPOption;
 
@@ -4432,8 +4433,11 @@ begin
   If (ChangeFileExt(aFileName,RTLString(''))='*') then
     aFileName:=ChangeFileExt(ExtractFileName(CurFilename),Ext);
   aFullFileName:=FileResolver.FindResourceFileName(aFileName);
-  if aFullFileName='' then
-    Error(nResourceFileNotFound,SErrResourceFileNotFound,[aFileName]);
+  if (aFullFileName='') then
+    if (po_WarnResourceNotFound in Options) then
+      Self.DoLog(mtWarning,nResourceFileNotFound,SErrResourceFileNotFound,[aFileName])
+    else
+      Error(nResourceFileNotFound,SErrResourceFileNotFound,[aFileName]);
   // Check if we can find a handler.
   if Ext<>'' then
     Ext:=Copy(Ext,2,Length(Ext)-1);