Browse Source

* debug shows directory/file checks

git-svn-id: trunk@9115 -
peter 18 years ago
parent
commit
604c918ba9
4 changed files with 39 additions and 7 deletions
  1. 2 2
      utils/fppkg/pkgfpmake.pp
  2. 28 2
      utils/fppkg/pkgglobals.pp
  3. 6 0
      utils/fppkg/pkgmessages.pp
  4. 3 3
      utils/fppkg/pkgoptions.pp

+ 2 - 2
utils/fppkg/pkgfpmake.pp

@@ -113,14 +113,14 @@ Procedure TFPMakeCompiler.CompileFPMake;
     if Options.FPMakeLocalUnitDir<>'' then
       begin
         AUnitDir:=IncludeTrailingPathDelimiter(Options.FPMakeLocalUnitDir+AUnitName);
-        if DirectoryExists(AUnitDir) then
+        if DirectoryExistsLog(AUnitDir) then
           begin
             Result:=true;
             exit;
           end;
       end;
     AUnitDir:=IncludeTrailingPathDelimiter(Options.FPMakeGlobalUnitDir+AUnitName);
-    if DirectoryExists(AUnitDir) then
+    if DirectoryExistsLog(AUnitDir) then
       begin
         Result:=true;
         exit;

+ 28 - 2
utils/fppkg/pkgglobals.pp

@@ -37,6 +37,8 @@ Procedure Error(Fmt : String; const Args : array of const);
 // Utils
 function maybequoted(const s:string):string;
 Function FixPath(const S : String) : string;
+Function DirectoryExistsLog(const ADir:string):Boolean;
+Function FileExistsLog(const AFileName:string):Boolean;
 Procedure DeleteDir(const ADir:string);
 Procedure SearchFiles(SL:TStringList;const APattern:string);
 Function GetCompilerInfo(const ACompiler,AOptions:string):string;
@@ -94,8 +96,12 @@ begin
   if not(Level in Verbosity) then
     exit;
   Prefix:='';
-  if Level=vWarning then
-    Prefix:=SWarning;
+  case Level of
+    vWarning :
+      Prefix:=SWarning;
+    vDebug :
+      Prefix:=SDebug;
+  end;
   Writeln(stdErr,Prefix,Msg);
 end;
 
@@ -171,6 +177,26 @@ begin
 end;
 
 
+Function DirectoryExistsLog(const ADir:string):Boolean;
+begin
+  result:=SysUtils.DirectoryExists(ADir);
+  if result then
+    Log(vDebug,SDbgDirectoryExists,[ADir,SDbgFound])
+  else
+    Log(vDebug,SDbgDirectoryExists,[ADir,SDbgNotFound]);
+end;
+
+
+Function FileExistsLog(const AFileName:string):Boolean;
+begin
+  result:=SysUtils.FileExists(AFileName);
+  if result then
+    Log(vDebug,SDbgFileExists,[AFileName,SDbgFound])
+  else
+    Log(vDebug,SDbgFileExists,[AFileName,SDbgNotFound]);
+end;
+
+
 Procedure DeleteDir(const ADir:string);
 var
   Info : TSearchRec;

+ 6 - 0
utils/fppkg/pkgmessages.pp

@@ -7,6 +7,7 @@ interface
 
 Resourcestring
   SWarning                   = 'Warning: ';
+  SDebug                     = 'Debug: ';
 
   SErrInValidArgument        = 'Invalid command-line argument at position %d : %s';
   SErrNeedArgument           = 'Option at position %d (%s) needs an argument';
@@ -60,6 +61,11 @@ Resourcestring
   SLogLoadingPackagesFile    = 'Loading packages information from "%s"';
   SLogLoadingVersionsFile    = 'Loading local versions information from "%s"';
 
+  SDbgFound                  = 'Found';
+  SDbgNotFound               = 'Not Found';
+  SDbgDirectoryExists        = 'Directory "%s" %s';
+  SDbgFileExists             = 'File "%s" %s';
+
 
 implementation
 

+ 3 - 3
utils/fppkg/pkgoptions.pp

@@ -327,9 +327,9 @@ begin
   FFPMakeLocalUnitDir:=FLocalInstallDir+'units'+PathDelim+CompilerTarget+PathDelim;
   for i:=low(FPMKUnitDeps) to high(FPMKUnitDeps) do
     begin
-      if not DirectoryExists(FFPMakeGlobalUnitDir+FPMKUnitDeps[i]+PathDelim) and
-         not DirectoryExists(FFPMakeLocalUnitDir+FPMKUnitDeps[i]+PathDelim) then
-        Log(vWarning,SWarnFPMKUnitNotFound,[FPMKUnitDeps[i]]);
+      if not DirectoryExistsLog(FFPMakeGlobalUnitDir+FPMKUnitDeps[i]+PathDelim) and
+         not DirectoryExistsLog(FFPMakeLocalUnitDir+FPMKUnitDeps[i]+PathDelim) then
+        Log(vWarning,SWarnFPMKUnitDirNotFound,[FPMKUnitDeps[i]]);
     end;
 end;