41 for (
const auto &file : files) {
43 if (loader->willLoad(file)) {
59 char full_path[PATH_MAX];
60 std::vector<std::string> names[2];
63 dp =
opendir(directory.c_str());
68 while ((d =
readdir(dp)) != NULL) {
70 if (d->d_name[0] == 0 || d->d_name[0] ==
'.' || strcmp(d->d_name,
"dev") == 0 || strcmp(d->d_name,
"trashbin") == 0)
73 snprintf(full_path,
sizeof(full_path),
"%s/%s", directory.c_str(), d->d_name);
75 type = S_ISDIR(sb.st_mode) ? 0 : 1;
76 names[type].push_back(full_path);
80 for (type = 0; type < 2; type++) {
81 std::sort(names[type].begin(), names[type].end());
86 for (
const auto &dir : names[0]) {
93 if (loader->willLoad(filename)) {
94 loader->load(reader, filename);
void bufferreader_destroy(BufferReader *br)
Destroy a BufferReader.
void processFiles(const std::vector< std::string > &files)
Process a list of files.
BufferReader * bufferreader_create()
Create a new BufferReader.
DIR * opendir(const char *)
Global type definitions and header inclusions.
void collect(const std::string &directory)
Recurse in the specified directory, finding all files and calling loaders to process them...
BufferReader * m_reader
Reader used to load files.
virtual void load(BufferReader *reader, const std::string &filename) override
Load assets from the specified reader.
virtual ~AssetCollector()
Destructor.
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
Initialize or create a BufferReader from a file path.
Compatibility implementations of useful nonstandard types and functions.
AssetCollector()
Constructor.
struct dirent * readdir(DIR *)
std::vector< AssetLoader * > m_loaders
Registered loaders.
Abstract buffer handler, processing a BufferReader.