Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any C++ lightweight cross-platform file system library?

I need a lightweight cross-platform file system library for game development. I want to ship my games on Windows, Linux and Mac.

As far as I know, using dirent.h works on all three platforms. However, I wanted to know if a library that is simpler to use exists - using directly dirent was confusing for me and I didn't get anywhere.

I also tried Boost, but I don't like the fact that it's not lightweight and it gave me trouble on Unix ports of my game.

Features I require are:

  • Recursively read directory trees
  • Get all files in a directory
  • Get all sub-directories in a directory
like image 654
Vittorio Romeo Avatar asked Dec 02 '12 14:12

Vittorio Romeo


1 Answers

I've created my own file system library (tested on Windows and Linux, both with GCC and Clang).

You can find it in the SSVUtils library: https://github.com/SuperV1234/SSVUtils

SSVUtils has no external dependencies.

Example usage:

log("Getting all page.json files", "loadPages");

string pagesPath("Json/Pages/");
vector<string> pageJsonPaths{getScan<Mode::Recurse, Type::File, Pick::ByName>(pagesPath, "page.json")};
like image 70
Vittorio Romeo Avatar answered Oct 29 '22 07:10

Vittorio Romeo