Working on an SDL2 application which will run on Windows® and Linux.
I am at a point where I need a cross-platform file system IO library which works with SDL2.
Need file system navigation with directory listing and folder/file creation/deletion.
(again, must work on both Windows® and Linux)
Any recommendations?
(want the best & it must be 100% free)…
Thanks!
Jesse
Our application is on GitHub below(it’s a VERY early alpha that does not do much):
I simply call the appropriate functions in the C runtime (chdir, mkdir, rmdir, readdir and so on), they work on all the platforms I support (Windows, Linux, MacOS, Android, iOS). As noted in another thread, you may need to use MinGW or Cygwin (not Visual Studio) if you want to call them on Windows.
I agree it would be nice. You omitted SDL_chdir from the list, and SDL_findfirst / SDL_findnext don’t map very well to the Linux way of doing things (when would SDL call closedir?). Possibly SDL_opendir, SDL_readdir and SDL_closedir would be a better fit (SDL_closedir could be a NOP in Windows).
That was intentional. I could live without chdir and just navigate around by supplying relative paths based off SDL_GetBasePath, and SDL_GetPrefPath which would be a safer approach maybe?
It’s a fair point: chdir doesn’t have much of a meaning on Android. I think we need SDL_GetTempPath in addition to those others, to have somewhere to put temporary files.
boost::filesystem only crashed and corrupted memory of mine, and (as usual) StackOverflow whined and didn’t bother to help, so I had to resort to making my own library.
It ended up being not as hard as I originally thought (though obviously not super-portable, it’s UNIX & Windows only.