Hi.
Got the solution on my own. In the middle of the code, where either a directory or a file is processed, every time a file being selected by the file mask is deleted, the function returns to the caller. The later will restart a scan from the very beginning. This takes time, of course, but works.
IF you are interested, have a look into the following code: 1. Calling master code snippet:
FIsoRoot := StarBurn_ISO9660JolietFileTree_GetRoot(FTrack); // the loop is a tentative for eliminatig scan surprises while (FIsoRoot <> nil) and ScanDirectory(FTrack, FIsoRoot, FileMask) do begin FIsoRoot := StarBurn_ISO9660JolietFileTree_GetRoot(FTrack); Res := StarBurn_ISO9660JolietFileTree_SeekToBegin(FTrack, PCHAR(@ErrorText[1]), sizeof(ErrorText), Status); end;
2. the executive code:
function ScanDirectory(Track, DirNode: Pointer; FileMask: string): Boolean; // procedure recursive ************************ var NewNode: Pointer; Attributes: Integer; FileName: string; begin Result := False; FileName := GetNodeFileName(Track, DirNode); NewNode := StarBurn_ISO9660JolietFileTree_GetFirstKid(FTrack, DirNode); while (NewNode <> nil) and (not Result) do begin FileName := GetNodeFileName(Track, NewNode); Attributes := StarBurn_ISO9660JolietFileTree_GetAttributes(FTrack, NewNode); if (Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY then Result := ScanDirectory(Track, NewNode, FileMask) else Result := TestAndDeleteFile(Track, NewNode, FileMask); // as soon as we delete a node, get out giving control to our caller if Result then break; NewNode := StarBurn_ISO9660JolietFileTree_GetNextKid(Track, DirNode, NewNode); end; end;
As a matter of conclusion, whenever a walk is made thru the FileTree and a node is deleted, the walker manager seems to loose control of the walker pointer for subsequent queries for NextKid. I guess this needs some fixing work.
BTW, if the goal is to have a Tree manipulation, some other functionnalities present into the most basic Tree (either visual or not) could be welcome and for instance: HasChildren (instead to have to test for a directory, which is time consuming).
Anyway, this fix is time consuming when the tree has a lot of files (26000 in my case). On another point of view, I was really looking for something which could help to avoid some files not to be loaded into the tree (aka ZipForge with their ExclustionMasks).
Antonio.
|