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

Oct 28, 2009 at 6:30pm
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 Oct 28, 2009 at 6:31pm
Oct 28, 2009 at 8:02pm
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
Oct 28, 2009 at 8:28pm
What!?

What kind of problems were you experiencing with the boost filesystem library?
Oct 28, 2009 at 8:48pm
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 Oct 28, 2009 at 8:50pm
Topic archived. No new replies allowed.