From 540cad830d639a57d9effe9b18283b3bb8cd7a07 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Wed, 11 Jun 2008 13:17:03 +0200 Subject: TLocalTreeEngine: Print warning messages when something goes wrong --- UEngines.pas | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/UEngines.pas b/UEngines.pas index 5edc0d1..e490cca 100644 --- a/UEngines.pas +++ b/UEngines.pas @@ -549,7 +549,7 @@ var Handle : PDirectoryStream; StatBuf_local := Libc.malloc(sizeof(TGlibc_stat64)); Libc.memset(StatBuf_local, 0, sizeof(TGlibc_stat64)); if glibc_lstat64(PChar(FPath), StatBuf_local) <> 0 then begin - DebugMsg(['*** Error reading file stat AddEntry(lstat): ', strerror(errno)]); + DebugMsg(['*** TLocalTreeEngine.FillDirFiles: Error reading file stat AddEntry("', FPath, '"): ', strerror(errno)]); Exit; end; Item := Libc.malloc(SizeOf(TDataItemSL)); @@ -610,7 +610,10 @@ begin AddEntry(APath, True, True); FilesList := TList.Create; APath := IncludeTrailingPathDelimiter(APath); - if __chdir(PChar(APath)) <> 0 then Exit; + if __chdir(PChar(APath)) <> 0 then begin + DebugMsg(['*** TLocalTreeEngine.FillDirFiles: chdir to "', APath, '" failed: ', strerror(errno)]); + Exit; + end; Handle := OpenDir(PChar(APath)); if Assigned(Handle) then repeat @@ -618,7 +621,10 @@ begin if Assigned(DirEnt) and Assigned(PChar(@DirEnt^.d_name[0])) and (PChar(@DirEnt^.d_name[0]) <> '.') and (PChar(@DirEnt^.d_name[0]) <> '..') then begin StatBuf_global := Libc.malloc(sizeof(TGlibc_stat64)); Libc.memset(StatBuf_global, 0, sizeof(TGlibc_stat64)); - if glibc_lstat64(PChar(@DirEnt^.d_name[0]), StatBuf_global) <> 0 then Continue; + if glibc_lstat64(PChar(@DirEnt^.d_name[0]), StatBuf_global) <> 0 then begin + DebugMsg(['*** TLocalTreeEngine.FillDirFiles: Error lstat-ing ("', PChar(@DirEnt^.d_name[0]), '"): ', strerror(errno)]); + Continue; + end; if __S_ISTYPE(StatBuf_global^.st_mode, __S_IFDIR) then begin FillDirFiles(APath + String(PChar(@DirEnt^.d_name[0])), List, ALevel + 1); __chdir(PChar(APath)); -- cgit v1.2.3