FileSize not working?
Monkey Forums/Monkey Programming/FileSize not working?
| ||
Hi all, I'm trying to count how many level files are available to my game, but I can't seem to get FileSize() to return anything other than 0.For Local t:Int = 1 To 1000 Local str:String = "levels/level"+t+".tmx" Local s:Int = FileType("str") Print str+" "+s If s <> 0 Then MaxLevel = t If s = 0 Then t = 1000 ' jump to end of loop if no file number Next Am I doing something incorrectly? |
| ||
My guess: have you added "*.tmx" to your list of text file extensions? See docs -> App Config Settings -> #TEXT_FILES if not. |
| ||
Done that already, no help at all. I switched to this instead... Method countLevels() For Local t:Int = 1 To 1000 Local s:String = LoadString("levels/level"+t+".tmx") If s <> "" Then MaxLevel = t If s = "" Then t = 1000 ' jump to end of loop if no file number 'Print s Next Print "MaxLevel "+MaxLevel End Method It works for detecting if a file exists or not, which is what I was after. |