hi forum,
i use UseDirectory() in a recursive procedure, and the debugger tells
me "#FileSystem object not initialised".
does anyone know why that is so?
here is my code:
Code: Select all
#Window1 = 1
#W1Btn1 = 1
#Window1Flags = #PB_Window_MinimizeGadget | #PB_Window_SystemMenu
Structure DIRS
dirhandle.l
fullpath.s
EndStructure
NewList dirlist.DIRS()
Procedure ReadPath(path$, dir_num)
Debug dir_num
If ExamineDirectory(dir_num, path$, "*.*")
openflag.l = #TRUE
Repeat
FileType = NextDirectoryEntry()
FileName$ = DirectoryEntryName()
If FileType = 2
If FileName$ "." And FileName$ ".."
AddElement(dirlist())
fullpath$ = path$+FileName$+"\"
dirlist()\fullpath = fullpath$
ReadPath(fullpath$, dir_num+1)
UseDirectory(dir_num)
EndIf
EndIf
Until FileType = 0
EndIf
EndProcedure
hwnd = OpenWindow( #Window1, 300,300,100,100, #Window1Flags,"test")
If CreateGadgetList(WindowID(1))
ButtonGadget(#W1Btn1,1,1 ,89,25,"Choose Dir")
EndIf
Repeat
Delay(1)
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventGadget
Select EventGadgetID()
Case #W1Btn1
ClearList(dirlist())
app_path$ = PathRequester("Application Path", "c:\")
If app_path$ ""
dir_num = 1
ReadPath(app_path$, dir_num)
res = CountList(dirlist())
Debug res
EndIf
EndSelect
EndSelect
Until EventID = #PB_EventCloseWindow
End
