domeengine / dome

A lightweight game development environment where games can be written in Wren
https://www.domeengine.com
MIT License
473 stars 40 forks source link

FileSystem listDirectories has unexpected entries #273

Open Deijin27 opened 3 months ago

Deijin27 commented 3 months ago

When you run FileSystem.listDirectories there is two extra entries in the list "." and ".." This seems to be inherent to the win32 FindNextFile function called by tinydir.

It caught me out because I was writing a function to recursively get files from a directory, and I was getting an infinite loop so the dome window never showed but dome was still running.

I'm thinking these should probably be filtered out and not included in the result of FileSystem.listDirectories. What do you think?

avivbeeri commented 3 months ago

I need to check if this happens on Linux and I'll decide which way the API should go based on that

On Fri, 12 Jul 2024, 22:12 Deijin, @.***> wrote:

When you run FileSystem.listDirectories there is two extra entries in the list "." and ".." This seems to be inherent to the win32 FindNextFile function called by tinydir.

It caught me out because I was writing a function to recursively get files from a directory, and I was getting an infinite loop so the dome window never showed but dome was still running.

I'm thinking these should probably be filtered out and not included in the result of FileSystem.listDirectories. What do you think?

— Reply to this email directly, view it on GitHub https://github.com/domeengine/dome/issues/273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALBBLZCCHWH4O3QPLC5TX3ZMBBFLAVCNFSM6AAAAABKZSZYHGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDMMZVGM4DSNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Deijin27 commented 3 months ago

Just tested on linux and the dots are there too.

The function for this in wren_cli does not have dots. Neither do any apis in other programming languages I know of. I can't think of a situation where you wouldn't need to filter them out to get what you want.