' fixed 2021-11-16 for folders or files OVER 32,000+ Integer Range
' ref 2021-11-09 Steve update GetLists: https://www.qb64.org/forum/index.php?topic=4360.msg138031#msg138031
' Thanks SNcNeill ! for a cross platform method to get file and directory lists
'put this block in main code section of your program close to top
'' direntry.h needs to be in QB64 folder '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Declare CustomType Library ".\direntry"
' Function load_dir& (s As String)
' Function has_next_entry& ()
' Sub close_dir ()
' Sub get_next_entry (s As String, flags As Long, file_size As Long)
'End Declare
' fix 2021-11-16 I have a folder in Downloads that is over 40,000 files mostly HTML which caused subscript errors
' change DirCount and FileCount to Long from Integer
DirCount = 0: FileCount = 0
slash$ = "\"
slash$ = "/"
If Right$(SearchDirectory$
, 1) <> "/" And Right$(SearchDirectory$
, 1) <> "\" Then SearchDirectory$
= SearchDirectory$
+ slash$
length = has_next_entry
get_next_entry nam$, flags, file_size
DirCount = DirCount + 1
DirList(DirCount) = nam$
FileCount = FileCount + 1
FileList(FileCount) = nam$
Else 'This else should never actually trigger close_dir