简体   繁体   中英

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

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")};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM