简体   繁体   English

有没有C ++轻量级跨平台文件系统库?

[英]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. 我想在Windows,Linux和Mac上发布我的游戏。

As far as I know, using dirent.h works on all three platforms. 据我所知,使用dirent.h可以在所有三个平台上运行。 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. 我也尝试过Boost,但我不喜欢它不是轻量级的事实,它让我在游戏的Unix端口上遇到了麻烦。

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). 我已经创建了自己的文件系统库(在Windows和Linux上进行了测试,包括GCC和Clang)。

You can find it in the SSVUtils library: https://github.com/SuperV1234/SSVUtils 您可以在SSVUtils库中找到它: https//github.com/SuperV1234/SSVUtils

SSVUtils has no external dependencies. SSVUtils没有外部依赖项。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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