7

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
scry
  • 1,237
  • 12
  • 29
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416
  • Are you asking about the library that provides easier access to the existing filesystem OR about the library that implements a filesystem (container)? – Eugene Mayevski 'Callback Dec 02 '12 at 14:23
  • @EugeneMayevski'EldoSCorp I'm asking about a library that helps me get existing directories/files in the hard drive. For example, I want to get all the .png files in "C:/MyGame/Data/Images" without much hassle. – Vittorio Romeo Dec 02 '12 at 14:25
  • Have you checked your GUI framework (you are writing a game, right?)? Sometimes they tend to include extra stuff like filesystem api. – hate-engine Dec 02 '12 at 14:30
  • @hate-engine I'm using SFML, and unfortunately it does not include a filesystem api. – Vittorio Romeo Dec 02 '12 at 14:32

1 Answers1

2

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")};
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416