libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.98k stars 1.84k forks source link

SDL3: Disambiguating folder/file entries in SDL_GlobDirectory() #11341

Open r-lyeh opened 3 weeks ago

r-lyeh commented 3 weeks ago

Hello guys, SDL_GlobDirectory() returns a list of items but end-users cannot know whether each item is a file or a directory, unless they hit a disk access per entry (via stat() or similar strategies). Have you thought returning the list of files as-is, but the directories would be having an ending '/' (or '\' slash) character at the end?

Something like:

art/
docs/
code.md

Instead of:

art
docs
code.md

PS: Great job on SDL3 guys! :D

icculus commented 3 weeks ago

If the concern is disk access, we would also have to call stat internally, as readdir doesn't return this information. Also, I assume this stuff goes in the kernel disk cache for normal access patterns.