File operations, is there a cross platform way to do it?

Specifically, reading the contents of a folder (folders and files). I'm currently creating a small game in C++ with SDL and experimenting with file-based, user creatable content rather than hardcoded maps etc.

As this is different between different operating systems, is there a library that works on many systems (Windows, Linux mainly but also MacOS, BSD etc would be nice to have compatibility with)

I'm on Ubuntu and Debian GNU/Linux at the moment. Being as portable as portable is always a priority.
Last edited on
There's Boost, but frankly, I've found it impossible to reliably link against it on Linux. All Unices use the same interface for file operations, AFAIK.
One solution could be to write wrapper functions in combination with conditional compilation.
http://predef.sourceforge.net/preos.html
What!?

What kind of problems were you experiencing with the boost filesystem library?
Well, it seems the specific binaries I needed to link to to get a specific function varied from version to version (For example, if I wanted the boost::filesystem namespace, one version required me to link filesystem.a, while another required also system.a). Either that or OpenSuse modified their version. Also, compiling from source gave me some ridiculous filenames for the binaries and tucked them away deep in the directory structure.
Last edited on
Topic archived. No new replies allowed.