Hello people
I’m losing it, I’m breaking myself over the recursive search.
The goal is, give a parameter a name, for example “test”, and this function searches a file in a bunch of folders, named “test.block”
atm, I have this:
[code]Function SearchBlockInFolder(blockName As String, optional fi As FolderItem) As FolderItem
Dim i As Integer
Dim f As FolderItem
If fi = Nil Then
f = GetBlocksFolder
Else
f = fi
End If
For i = 1 To f.Count
If f.TrueItem(i).Directory then
Dim foundBlock As FolderItem
foundBlock = SearchBlockInFolder(blockName)
If foundBlock <> Nil Then
Return foundBlock
End If
ElseIf NthField(f.TrueItem(i).DisplayName, “.”, 0) = blockName And NthField(f.TrueItem(i).DisplayName, “.”, 1) = “block” Then
Return f
End If
next
End Function
[/code]
It justs keeps running. I looked too long at this code. Can someone give me an insight on what is going wrong here?
Thanks a lot.