[cpp,c++] std::filesystem and nirtcpp/(irrlicht) file system
Nirtcpp forks from irrlicht.
#include <utxcpp/core.hpp> #include <nirtcpp.hpp> #include <filesystem> namespace fs = std::filesystem; int main(int argc, char * argv[]) try { if (argc != 2) throw std::runtime_error{"prog <search path>"}; const fs::path search = argv[1]; nirt::NirtcppDevice * device = nirt::createDevice( nirt::video::EDT_NULL, nirt::core::dimension2du{2560, 1600}, 32, false, true, true, nullptr); utx::rt_assert(device != nullptr); nirt::io::IFileSystem * nfs = device->getFileSystem(); for (const auto & entry: fs::recursive_directory_iterator{search}) { const fs::file_status & status = entry.status(); if ( (fs::status_known(status)?fs::exists(status):fs::exists(entry)) && entry.is_regular_file() && entry.path().extension() == ".pk3" ) { if (nfs->addFileArchive(entry.path().string().data())) utx::print(entry, "added"); } } nirt::scene::ISceneManager * smgr = device->getSceneManager(); nirt::scene::IAnimatedMesh * map_mesh = smgr->getMesh("q3dm6ish.bsp"); } catch (std::exception & e) { utx::printe("[std::exception]", e.what()); return 1; }
Comments
Display comments as Linear | Threaded