Browse Source

pas2js: quote debug info filenames

git-svn-id: trunk@38966 -
Mattias Gaertner 7 years ago
parent
commit
200f884024
2 changed files with 67 additions and 50 deletions
  1. 55 50
      packages/pastojs/src/pas2jscompiler.pp
  2. 12 0
      packages/pastojs/src/pas2jslogger.pp

+ 55 - 50
packages/pastojs/src/pas2jscompiler.pp

@@ -40,39 +40,40 @@ const
   nSyntaxModeIs = 102; sSyntaxModeIs = 'Syntax mode is %s';
   nSyntaxModeIs = 102; sSyntaxModeIs = 'Syntax mode is %s';
   nMacroDefined = 103; sMacroDefined = 'Macro defined: %s';
   nMacroDefined = 103; sMacroDefined = 'Macro defined: %s';
   nUsingPath = 104; sUsingPath = 'Using %s: "%s"';
   nUsingPath = 104; sUsingPath = 'Using %s: "%s"';
-  nFolderNotFound = 105; sFolderNotFound = '%s not found: "%s"';
-  nNameValue = 106; sNameValue = '%s: "%s"';
-  nReadingOptionsFromFile = 107; sReadingOptionsFromFile = 'Reading options from file "%s"';
-  nEndOfReadingConfigFile = 108; sEndOfReadingConfigFile = 'End of reading config file "%s"';
-  nInterpretingFileOption = 109; sInterpretingFileOption = 'interpreting file option "%s"';
-  nSourceFileNotFound = 110; sSourceFileNotFound = 'source file not found "%s"';
-  nFileIsFolder = 111; sFileIsFolder = 'expected file, but found directory "%s"';
+  nFolderNotFound = 105; sFolderNotFound = '%s not found: %s';
+  nNameValue = 106; sNameValue = '%s: %s';
+  nReadingOptionsFromFile = 107; sReadingOptionsFromFile = 'Reading options from file %s';
+  nEndOfReadingConfigFile = 108; sEndOfReadingConfigFile = 'End of reading config file %s';
+  nInterpretingFileOption = 109; sInterpretingFileOption = 'interpreting file option %s';
+  nSourceFileNotFound = 110; sSourceFileNotFound = 'source file not found %s';
+  nFileIsFolder = 111; sFileIsFolder = 'expected file, but found directory %s';
   nConfigFileSearch = 112; sConfigFileSearch = 'Configfile search: %s';
   nConfigFileSearch = 112; sConfigFileSearch = 'Configfile search: %s';
-  nHandlingOption = 113; sHandlingOption = 'handling option "%s"';
-  nQuickHandlingOption = 114; sQuickHandlingOption = 'quick handling option "%s"';
-  nOutputDirectoryNotFound = 115; sOutputDirectoryNotFound = 'output directory not found: "%s"';
-  nUnableToWriteFile = 116; sUnableToWriteFile = 'Unable to write file "%s"';
-  nWritingFile = 117; sWritingFile = 'Writing file "%s" ...';
+  nHandlingOption = 113; sHandlingOption = 'handling option %s';
+  nQuickHandlingOption = 114; sQuickHandlingOption = 'quick handling option %s';
+  nOutputDirectoryNotFound = 115; sOutputDirectoryNotFound = 'output directory not found: %s';
+  nUnableToWriteFile = 116; sUnableToWriteFile = 'Unable to write file %s';
+  nWritingFile = 117; sWritingFile = 'Writing file %s ...';
   nCompilationAborted = 118; sCompilationAborted = 'Compilation aborted';
   nCompilationAborted = 118; sCompilationAborted = 'Compilation aborted';
-  nCfgDirective = 119; sCfgDirective = 'cfg directive "%s": %s';
+  nCfgDirective = 119; sCfgDirective = 'cfg directive %s: %s';
   nUnitCycle = 120; sUnitCycle = 'Unit cycle found %s';
   nUnitCycle = 120; sUnitCycle = 'Unit cycle found %s';
   nOptionForbidsCompile = 121; sOptionForbidsCompile = 'Option -Ju forbids to compile unit "%s"';
   nOptionForbidsCompile = 121; sOptionForbidsCompile = 'Option -Ju forbids to compile unit "%s"';
   nUnitNeedsCompileDueToUsedUnit = 122; sUnitsNeedCompileDueToUsedUnit = 'Unit "%s" needs compile due to used unit "%s"';
   nUnitNeedsCompileDueToUsedUnit = 122; sUnitsNeedCompileDueToUsedUnit = 'Unit "%s" needs compile due to used unit "%s"';
   nUnitNeedsCompileDueToOption = 123; sUnitsNeedCompileDueToOption = 'Unit "%s" needs compile due to option "%s"';
   nUnitNeedsCompileDueToOption = 123; sUnitsNeedCompileDueToOption = 'Unit "%s" needs compile due to option "%s"';
   nUnitNeedsCompileJSMissing = 124; sUnitsNeedCompileJSMissing = 'Unit "%s" needs compile, js file missing "%s"';
   nUnitNeedsCompileJSMissing = 124; sUnitsNeedCompileJSMissing = 'Unit "%s" needs compile, js file missing "%s"';
-  nUnitNeedsCompilePasHasChanged = 125; sUnitsNeedCompilePasHasChanged = 'Unit "%s" needs compile, Pascal file has changed, js is "%s"';
-  nParsingFile = 126; sParsingFile = 'Parsing "%s" ...';
-  nCompilingFile = 127; sCompilingFile = 'Compiling "%s" ...';
+  nUnitNeedsCompilePasHasChanged = 125; sUnitsNeedCompilePasHasChanged = 'Unit "%s" needs compile, Pascal file has changed, js is %s';
+  nParsingFile = 126; sParsingFile = 'Parsing %s ...';
+  nCompilingFile = 127; sCompilingFile = 'Compiling %s ...';
   nExpectedButFound = 128; sExpectedButFound = 'Illegal unit name: Expected "%s", but found "%s"';
   nExpectedButFound = 128; sExpectedButFound = 'Illegal unit name: Expected "%s", but found "%s"';
   nLinesInFilesCompiled = 129; sLinesInFilesCompiled = '%s lines in %s files compiled, %s sec';
   nLinesInFilesCompiled = 129; sLinesInFilesCompiled = '%s lines in %s files compiled, %s sec';
   nTargetPlatformIs = 130; sTargetPlatformIs = 'Target platform is %s';
   nTargetPlatformIs = 130; sTargetPlatformIs = 'Target platform is %s';
   nTargetProcessorIs = 131; sTargetProcessorIs = 'Target processor is %s';
   nTargetProcessorIs = 131; sTargetProcessorIs = 'Target processor is %s';
   nMessageEncodingIs = 132; sMessageEncodingIs = 'Message encoding is %s';
   nMessageEncodingIs = 132; sMessageEncodingIs = 'Message encoding is %s';
-  nUnableToTranslatePathToDir = 133; sUnableToTranslatePathToDir = 'Unable to translate path "%s" to directory "%s"';
+  nUnableToTranslatePathToDir = 133; sUnableToTranslatePathToDir = 'Unable to translate path %s to directory %s';
   nSrcMapSourceRootIs = 134; sSrcMapSourceRootIs = 'source map "sourceRoot" is %s';
   nSrcMapSourceRootIs = 134; sSrcMapSourceRootIs = 'source map "sourceRoot" is %s';
   nSrcMapBaseDirIs = 135; sSrcMapBaseDirIs = 'source map "local base directory" is %s';
   nSrcMapBaseDirIs = 135; sSrcMapBaseDirIs = 'source map "local base directory" is %s';
-  nUnitFileNotFound = 136; sUnitFileNotFound = 'unit file not found "%s"';
-  nInterfaceStyleIs = 137; sInterfaceStyleIs = 'Interface style is %s';
+  nUnitFileNotFound = 136; sUnitFileNotFound = 'unit file not found %s';
+  nClassInterfaceStyleIs = 137; sClassInterfaceStyleIs = 'Class interface style is %s';
+  nMacroXSetToY = 138; sMacroXSetToY = 'Macro %s set to %s';
   // Note: error numbers 201+ are used by Pas2jsFileCache
   // Note: error numbers 201+ are used by Pas2jsFileCache
 
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
@@ -892,6 +893,8 @@ begin
     RaiseInternalError(20180312142954,'');
     RaiseInternalError(20180312142954,'');
   FPCUReader:=PCUFormat.ReaderClass.Create;
   FPCUReader:=PCUFormat.ReaderClass.Create;
 
 
+  if ShowDebug then
+    Log.LogMsg(nParsingFile,[QuoteStr(PCUFilename)]);
   aFile:=Compiler.FileCache.LoadFile(PCUFilename,true);
   aFile:=Compiler.FileCache.LoadFile(PCUFilename,true);
   if aFile=nil then
   if aFile=nil then
     RaiseInternalError(20180312145941,PCUFilename);
     RaiseInternalError(20180312145941,PCUFilename);
@@ -1264,7 +1267,7 @@ begin
     writeln('TPas2jsCompilerFile.WritePCU precompiled ',PCUFilename);
     writeln('TPas2jsCompilerFile.WritePCU precompiled ',PCUFilename);
     {$ENDIF}
     {$ENDIF}
 
 
-    Log.LogMsg(nWritingFile,[Compiler.FileCache.FormatPath(PCUFilename)],'',0,0,
+    Log.LogMsg(nWritingFile,[QuoteStr(Compiler.FileCache.FormatPath(PCUFilename))],'',0,0,
                not (coShowLineNumbers in Compiler.Options));
                not (coShowLineNumbers in Compiler.Options));
 
 
     // check output directory
     // check output directory
@@ -1274,7 +1277,7 @@ begin
       {$IF defined(VerboseUnitQueue) or defined(VerbosePCUFiler)}
       {$IF defined(VerboseUnitQueue) or defined(VerbosePCUFiler)}
       writeln('TPas2jsCompilerFile.WritePCU output dir not found "',DestDir,'"');
       writeln('TPas2jsCompilerFile.WritePCU output dir not found "',DestDir,'"');
       {$ENDIF}
       {$ENDIF}
-      Log.LogMsg(nOutputDirectoryNotFound,[Compiler.FileCache.FormatPath(DestDir)]);
+      Log.LogMsg(nOutputDirectoryNotFound,[QuoteStr(Compiler.FileCache.FormatPath(DestDir))]);
       Compiler.Terminate(ExitCodeFileNotFound);
       Compiler.Terminate(ExitCodeFileNotFound);
     end;
     end;
     if Compiler.DirectoryExists(PCUFilename) then
     if Compiler.DirectoryExists(PCUFilename) then
@@ -1282,7 +1285,7 @@ begin
       {$IF defined(VerboseUnitQueue) or defined(VerbosePCUFiler)}
       {$IF defined(VerboseUnitQueue) or defined(VerbosePCUFiler)}
       writeln('TPas2jsCompilerFile.WritePCU file is folder "',DestDir,'"');
       writeln('TPas2jsCompilerFile.WritePCU file is folder "',DestDir,'"');
       {$ENDIF}
       {$ENDIF}
-      Log.LogMsg(nFileIsFolder,[Compiler.FileCache.FormatPath(PCUFilename)]);
+      Log.LogMsg(nFileIsFolder,[QuoteStr(Compiler.FileCache.FormatPath(PCUFilename))]);
       Compiler.Terminate(ExitCodeWriteError);
       Compiler.Terminate(ExitCodeWriteError);
     end;
     end;
 
 
@@ -1314,7 +1317,7 @@ end;
 procedure TPas2jsCompilerFile.ReadUnit;
 procedure TPas2jsCompilerFile.ReadUnit;
 begin
 begin
   if ShowDebug then
   if ShowDebug then
-    Log.LogPlain(['Debug: Parsing Pascal "',PasFilename,'"...']);
+    Log.LogMsg(nParsingFile,[QuoteStr(PasFilename)]);
   if FPasModule<>nil then
   if FPasModule<>nil then
     Compiler.RaiseInternalError(20180305190321,PasFilename);
     Compiler.RaiseInternalError(20180305190321,PasFilename);
   FReaderState:=prsReading;
   FReaderState:=prsReading;
@@ -2129,7 +2132,7 @@ begin
     else if (aFile.JSFilename<>'')
     else if (aFile.JSFilename<>'')
     and (DirectoryCache.FileAge(aFile.PasFilename)>DirectoryCache.FileAge(aFile.JSFilename))
     and (DirectoryCache.FileAge(aFile.PasFilename)>DirectoryCache.FileAge(aFile.JSFilename))
     then begin
     then begin
-      Mark(nUnitNeedsCompilePasHasChanged,[aFile.GetModuleName,FileCache.FormatPath(aFile.JSFilename)])
+      Mark(nUnitNeedsCompilePasHasChanged,[aFile.GetModuleName,QuoteStr(FileCache.FormatPath(aFile.JSFilename))])
     end;
     end;
   end;
   end;
 
 
@@ -2193,7 +2196,7 @@ begin
   if Checked.Find(aFile)<>nil then exit;
   if Checked.Find(aFile)<>nil then exit;
   Checked.Add(aFile);
   Checked.Add(aFile);
 
 
-  Log.LogMsg(nCompilingFile,[FileCache.FormatPath(aFile.PasFilename)],'',0,0,
+  Log.LogMsg(nCompilingFile,[QuoteStr(FileCache.FormatPath(aFile.PasFilename))],'',0,0,
     not (coShowLineNumbers in Options));
     not (coShowLineNumbers in Options));
 
 
   // convert dependencies
   // convert dependencies
@@ -2231,8 +2234,8 @@ begin
         if not SrcMapInclude then
         if not SrcMapInclude then
         begin
         begin
           Log.Log(mtError,
           Log.Log(mtError,
-            SafeFormat(sUnableToTranslatePathToDir,[LocalFilename,BaseDir]),
-            nUnableToTranslatePathToDir);
+            SafeFormat(sUnableToTranslatePathToDir,[QuoteStr(LocalFilename),QuoteStr(BaseDir)]),
+                       nUnableToTranslatePathToDir);
           Terminate(ExitCodeConverterError);
           Terminate(ExitCodeConverterError);
         end;
         end;
         // the source is included, do not translate the filename
         // the source is included, do not translate the filename
@@ -2373,19 +2376,19 @@ begin
       // write to file
       // write to file
 
 
       //writeln('TPas2jsCompiler.WriteJSFiles ',aFile.PasFilename,' ',aFile.JSFilename);
       //writeln('TPas2jsCompiler.WriteJSFiles ',aFile.PasFilename,' ',aFile.JSFilename);
-      Log.LogMsg(nWritingFile,[FileCache.FormatPath(DestFilename)],'',0,0,
+      Log.LogMsg(nWritingFile,[QuoteStr(FileCache.FormatPath(DestFilename))],'',0,0,
                  not (coShowLineNumbers in Options));
                  not (coShowLineNumbers in Options));
 
 
       // check output directory
       // check output directory
       DestDir:=ChompPathDelim(ExtractFilePath(DestFilename));
       DestDir:=ChompPathDelim(ExtractFilePath(DestFilename));
       if (DestDir<>'') and not DirectoryExists(DestDir) then
       if (DestDir<>'') and not DirectoryExists(DestDir) then
       begin
       begin
-        Log.LogMsg(nOutputDirectoryNotFound,[FileCache.FormatPath(DestDir)]);
+        Log.LogMsg(nOutputDirectoryNotFound,[QuoteStr(FileCache.FormatPath(DestDir))]);
         Terminate(ExitCodeFileNotFound);
         Terminate(ExitCodeFileNotFound);
       end;
       end;
       if DirectoryExists(DestFilename) then
       if DirectoryExists(DestFilename) then
       begin
       begin
-        Log.LogMsg(nFileIsFolder,[FileCache.FormatPath(DestFilename)]);
+        Log.LogMsg(nFileIsFolder,[QuoteStr(FileCache.FormatPath(DestFilename))]);
         Terminate(ExitCodeWriteError);
         Terminate(ExitCodeWriteError);
       end;
       end;
 
 
@@ -2417,7 +2420,7 @@ begin
       except
       except
         on E: Exception do begin
         on E: Exception do begin
           Log.LogPlain('Error: '+E.Message);
           Log.LogPlain('Error: '+E.Message);
-          Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(DestFilename)]);
+          Log.LogMsg(nUnableToWriteFile,[QuoteStr(FileCache.FormatPath(DestFilename))]);
           Terminate(ExitCodeWriteError);
           Terminate(ExitCodeWriteError);
         end;
         end;
       end;
       end;
@@ -2425,7 +2428,7 @@ begin
       // write source map
       // write source map
       if aFileWriter.SrcMap<>nil then
       if aFileWriter.SrcMap<>nil then
       begin
       begin
-        Log.LogMsg(nWritingFile,[FileCache.FormatPath(MapFilename)],'',0,0,
+        Log.LogMsg(nWritingFile,[QuoteStr(FileCache.FormatPath(MapFilename))],'',0,0,
                    not (coShowLineNumbers in Options));
                    not (coShowLineNumbers in Options));
         FinishSrcMap(aFileWriter.SrcMap);
         FinishSrcMap(aFileWriter.SrcMap);
         try
         try
@@ -2441,7 +2444,7 @@ begin
         except
         except
           on E: Exception do begin
           on E: Exception do begin
             Log.LogPlain('Error: '+E.Message);
             Log.LogPlain('Error: '+E.Message);
-            Log.LogMsg(nUnableToWriteFile,[FileCache.FormatPath(MapFilename)]);
+            Log.LogMsg(nUnableToWriteFile,[QuoteStr(FileCache.FormatPath(MapFilename))]);
             Terminate(ExitCodeWriteError);
             Terminate(ExitCodeWriteError);
           end;
           end;
         end;
         end;
@@ -2745,7 +2748,7 @@ var
 
 
   procedure DebugCfgDirective(const s: string);
   procedure DebugCfgDirective(const s: string);
   begin
   begin
-    Log.LogMsg(nCfgDirective,[Line,s],CurrentCfgFilename,CurrentCfgLineNumber,1,false);
+    Log.LogMsg(nCfgDirective,[QuoteStr(Line),s],CurrentCfgFilename,CurrentCfgLineNumber,1,false);
   end;
   end;
 
 
 var
 var
@@ -2756,7 +2759,7 @@ var
   CacheFile: TPas2jsCachedFile;
   CacheFile: TPas2jsCachedFile;
 begin
 begin
   if ShowTriedUsedFiles then
   if ShowTriedUsedFiles then
-    Log.LogMsgIgnoreFilter(nReadingOptionsFromFile,[CfgFilename]);
+    Log.LogMsgIgnoreFilter(nReadingOptionsFromFile,[QuoteStr(CfgFilename)]);
   IfLvl:=0;
   IfLvl:=0;
   SkipLvl:=0;
   SkipLvl:=0;
   Skip:=skipNone;
   Skip:=skipNone;
@@ -2771,7 +2774,7 @@ begin
       Line:=aFile.ReadLine;
       Line:=aFile.ReadLine;
       FCurrentCfgLineNumber:=aFile.LineNumber;
       FCurrentCfgLineNumber:=aFile.LineNumber;
       if ShowDebug then
       if ShowDebug then
-        Log.LogMsgIgnoreFilter(nInterpretingFileOption,[Line]);
+        Log.LogMsgIgnoreFilter(nInterpretingFileOption,[QuoteStr(Line)]);
       if Line='' then continue;
       if Line='' then continue;
       p:=PChar(Line);
       p:=PChar(Line);
       while (p^ in [' ',#9]) do inc(p);
       while (p^ in [' ',#9]) do inc(p);
@@ -2909,7 +2912,7 @@ begin
     aFile.Free;
     aFile.Free;
   end;
   end;
   if ShowTriedUsedFiles then
   if ShowTriedUsedFiles then
-    Log.LogMsgIgnoreFilter(nEndOfReadingConfigFile,[CfgFilename]);
+    Log.LogMsgIgnoreFilter(nEndOfReadingConfigFile,[QuoteStr(CfgFilename)]);
 end;
 end;
 
 
 procedure TPas2jsCompiler.LoadDefaultConfig;
 procedure TPas2jsCompiler.LoadDefaultConfig;
@@ -2987,9 +2990,9 @@ begin
   //writeln('TPas2jsCompiler.ReadParam ',Param,' ',Quick,' ',FromCmdLine);
   //writeln('TPas2jsCompiler.ReadParam ',Param,' ',Quick,' ',FromCmdLine);
   if ShowDebug then
   if ShowDebug then
     if Quick then
     if Quick then
-      Log.LogMsgIgnoreFilter(nQuickHandlingOption,[Param])
+      Log.LogMsgIgnoreFilter(nQuickHandlingOption,[QuoteStr(Param)])
     else
     else
-      Log.LogMsgIgnoreFilter(nHandlingOption,[Param]);
+      Log.LogMsgIgnoreFilter(nHandlingOption,[QuoteStr(Param)]);
   if Param='' then exit;
   if Param='' then exit;
   ParamMacros.Substitute(Param,Self);
   ParamMacros.Substitute(Param,Self);
   if Param='' then exit;
   if Param='' then exit;
@@ -3630,7 +3633,8 @@ begin
   r(mtInfo,nSrcMapSourceRootIs,sSrcMapSourceRootIs);
   r(mtInfo,nSrcMapSourceRootIs,sSrcMapSourceRootIs);
   r(mtInfo,nSrcMapBaseDirIs,sSrcMapBaseDirIs);
   r(mtInfo,nSrcMapBaseDirIs,sSrcMapBaseDirIs);
   r(mtFatal,nUnitFileNotFound,sUnitFileNotFound);
   r(mtFatal,nUnitFileNotFound,sUnitFileNotFound);
-  r(mtInfo,nInterfaceStyleIs,sInterfaceStyleIs);
+  r(mtInfo,nClassInterfaceStyleIs,sClassInterfaceStyleIs);
+  r(mtInfo,nMacroXSetToY,sMacroXSetToY);
   Pas2jsPParser.RegisterMessages(Log);
   Pas2jsPParser.RegisterMessages(Log);
 end;
 end;
 
 
@@ -4081,7 +4085,7 @@ begin
   Log.LogMsgIgnoreFilter(nTargetProcessorIs,[PasToJsProcessorNames[TargetProcessor]]);
   Log.LogMsgIgnoreFilter(nTargetProcessorIs,[PasToJsProcessorNames[TargetProcessor]]);
   // default syntax mode
   // default syntax mode
   Log.LogMsgIgnoreFilter(nSyntaxModeIs,[p2jscModeNames[Mode]]);
   Log.LogMsgIgnoreFilter(nSyntaxModeIs,[p2jscModeNames[Mode]]);
-  Log.LogMsgIgnoreFilter(nInterfaceStyleIs,[InterfaceTypeNames[InterfaceType]]);
+  Log.LogMsgIgnoreFilter(nClassInterfaceStyleIs,[InterfaceTypeNames[InterfaceType]]);
   // boolean options
   // boolean options
   for co in TP2jsCompilerOption do
   for co in TP2jsCompilerOption do
     Log.LogMsgIgnoreFilter(nOptionIsEnabled,
     Log.LogMsgIgnoreFilter(nOptionIsEnabled,
@@ -4093,8 +4097,8 @@ begin
   // source map options
   // source map options
   if SrcMapEnable then
   if SrcMapEnable then
   begin
   begin
-    Log.LogMsgIgnoreFilter(nSrcMapSourceRootIs,[SrcMapSourceRoot]);
-    Log.LogMsgIgnoreFilter(nSrcMapBaseDirIs,[SrcMapBaseDir]);
+    Log.LogMsgIgnoreFilter(nSrcMapSourceRootIs,[QuoteStr(SrcMapSourceRoot)]);
+    Log.LogMsgIgnoreFilter(nSrcMapBaseDirIs,[QuoteStr(SrcMapBaseDir)]);
   end;
   end;
 end;
 end;
 
 
@@ -4109,8 +4113,9 @@ begin
     S:=Defines[i];
     S:=Defines[i];
     M:=TMacroDef(Defines.Objects[i]);
     M:=TMacroDef(Defines.Objects[i]);
     if M<>nil then
     if M<>nil then
-      S:=S+'='+M.Value;
-    Log.LogMsgIgnoreFilter(nMacroDefined,[S]);
+      Log.LogMsgIgnoreFilter(nMacroXSetToY,[S,QuoteStr(M.Value)])
+    else
+      Log.LogMsgIgnoreFilter(nMacroDefined,[S]);
     end;
     end;
 end;
 end;
 
 
@@ -4121,7 +4126,7 @@ procedure TPas2jsCompiler.WriteFoldersAndSearchPaths;
     if Folder='' then exit;
     if Folder='' then exit;
     Log.LogMsgIgnoreFilter(nUsingPath,[aName,Folder]);
     Log.LogMsgIgnoreFilter(nUsingPath,[aName,Folder]);
     if not DirectoryExists(ChompPathDelim(Folder)) then
     if not DirectoryExists(ChompPathDelim(Folder)) then
-      Log.LogMsgIgnoreFilter(nFolderNotFound,[aName,Folder]);
+      Log.LogMsgIgnoreFilter(nFolderNotFound,[aName,QuoteStr(Folder)]);
   end;
   end;
 
 
 var
 var
@@ -4136,7 +4141,7 @@ begin
   for i:=0 to FileCache.IncludePaths.Count-1 do
   for i:=0 to FileCache.IncludePaths.Count-1 do
     WriteFolder('include path',FileCache.IncludePaths[i]);
     WriteFolder('include path',FileCache.IncludePaths[i]);
   WriteFolder('unit output path',FileCache.UnitOutputPath);
   WriteFolder('unit output path',FileCache.UnitOutputPath);
-  Log.LogMsgIgnoreFilter(nNameValue,['output file',FileCache.MainJSFile]);
+  Log.LogMsgIgnoreFilter(nNameValue,['output file',QuoteStr(FileCache.MainJSFile)]);
 end;
 end;
 
 
 procedure TPas2jsCompiler.WriteInfo;
 procedure TPas2jsCompiler.WriteInfo;
@@ -4220,16 +4225,16 @@ begin
   if (UnitFilename='') or not DirectoryCache.FileExists(UnitFilename) then
   if (UnitFilename='') or not DirectoryCache.FileExists(UnitFilename) then
   begin
   begin
     if aFormat=nil then
     if aFormat=nil then
-      Log.LogMsg(nSourceFileNotFound,[UnitFilename])
+      Log.LogMsg(nSourceFileNotFound,[QuoteStr(UnitFilename)])
     else
     else
-      Log.LogMsg(nUnitFileNotFound,[UnitFilename]);
+      Log.LogMsg(nUnitFileNotFound,[QuoteStr(UnitFilename)]);
     Terminate(ExitCodeFileNotFound);
     Terminate(ExitCodeFileNotFound);
   end;
   end;
 
 
   UnitFilename:=ExpandFileNameUTF8(UnitFilename,FileCache.BaseDirectory);
   UnitFilename:=ExpandFileNameUTF8(UnitFilename,FileCache.BaseDirectory);
   if DirectoryCache.DirectoryExists(UnitFilename) then
   if DirectoryCache.DirectoryExists(UnitFilename) then
   begin
   begin
-    Log.LogMsg(nFileIsFolder,[UnitFilename]);
+    Log.LogMsg(nFileIsFolder,[QuoteStr(UnitFilename)]);
     Terminate(ExitCodeFileNotFound);
     Terminate(ExitCodeFileNotFound);
   end;
   end;
 
 

+ 12 - 0
packages/pastojs/src/pas2jslogger.pp

@@ -143,6 +143,8 @@ type
 
 
 function CompareP2JMessage(Item1, Item2: Pointer): Integer;
 function CompareP2JMessage(Item1, Item2: Pointer): Integer;
 
 
+function QuoteStr(const s: string): string;
+function DeQuoteStr(const s: string): string;
 function AsString(Element: TPasElement; Full: boolean = true): string; overload;
 function AsString(Element: TPasElement; Full: boolean = true): string; overload;
 function AsString(Element: TJSElement): string; overload;
 function AsString(Element: TJSElement): string; overload;
 function DbgString(Element: TJSElement; Indent: integer): string; overload;
 function DbgString(Element: TJSElement; Indent: integer): string; overload;
@@ -163,6 +165,16 @@ begin
   Result:=Msg1.Number-Msg2.Number;
   Result:=Msg1.Number-Msg2.Number;
 end;
 end;
 
 
+function QuoteStr(const s: string): string;
+begin
+  Result:=AnsiQuotedStr(S,'"');
+end;
+
+function DeQuoteStr(const s: string): string;
+begin
+  Result:=AnsiDequotedStr(S,'"');
+end;
+
 function AsString(Element: TPasElement; Full: boolean): string;
 function AsString(Element: TPasElement; Full: boolean): string;
 begin
 begin
   if Element=nil then
   if Element=nil then