Code: Select all
#pragma once
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace io;
void initializeFileSystem(IrrlichtDevice * device)
{
IFileSystem * fs = device->getFileSystem();
fs->changeWorkingDirectoryTo("data");
IFileList * fl = fs->createFileList();
for(int i = 0; i < fl->getFileCount(); i++)
{
if(!fl->isDirectory(i))
{
// Only load ".zip" files
stringc fn(fl->getFileName(i));
if(fn.size() > 3)
{
stringc ext(fn.subString(fn.size() - 3, 3));
if(ext.equals_ignore_case("zip"))
fs->addZipFileArchive(fl->getFileName(i));
}
}
}
fl->drop();
fs->changeWorkingDirectoryTo("..");
}