I've tested it on Windows on version 6.21 and the problem manifests too there.
The following code has to be run with the C compiler from the IDE as it is:
Open the IDE, create a new file, select the C compiler
Code: Select all
EnableExplicit
Procedure listdir(Directory$)
Protected hnd.i
Protected Type$
Protected Size$
If Right(Directory$,1) <> "/"
Directory$ + "/"
EndIf
hnd = ExamineDirectory(#PB_Any, Directory$, "*.*")
If Not hnd
ProcedureReturn #False
EndIf
;CallDebugger
While NextDirectoryEntry(hnd)
If DirectoryEntryType(hnd) = #PB_DirectoryEntry_File
Type$ = "[File] "
Size$ = " (Size: " + DirectoryEntrySize(hnd) + ")"
Else
Type$ = "[Directory] "
Size$ = "" ; A directory doesn't have a size
If DirectoryEntryName(hnd) <> "." And DirectoryEntryName(hnd) <> ".."
listdir(Directory$ + DirectoryEntryName(hnd))
Else
Continue
EndIf
EndIf
Debug Type$ + DirectoryEntryName(hnd) + Size$
Wend
FinishDirectory(hnd)
EndProcedure
listdir("/")Run the program, hit continue so the code runs and stops again at the break point, it is obviously easier to hit whatever shortcut you use for "continue", keep hitting continue until...While NextDirectoryEntry(hnd)
Eventually you will see that the variables Directory$ Type$ and Size$ will display gibberish
Funnily if rather than use a break-point you uncomment the "calldebugger" line the corruption doesn't manifest.
It is not only the gibberish, the scan directory will eventually miss files, this is how I noticed something was off.
If you switch back to the regular ASM compiler all works fine.
This is what the gibberish looks like:


