From 7181d65a6e9fba8e63d279bbea5452a7c4b6c476 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Fri, 3 Feb 2023 17:35:28 +0100 Subject: [PATCH] Using C++17 filesystem directories + Print processing to time to log --- tools/RDIDebug.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tools/RDIDebug.cpp b/tools/RDIDebug.cpp index 826417d..298a684 100644 --- a/tools/RDIDebug.cpp +++ b/tools/RDIDebug.cpp @@ -7,8 +7,13 @@ * */ +#if __cplusplus < 201703L +#error "This code run on C++17 or upper." +#endif + #include #include +#include #include #include #include @@ -17,13 +22,12 @@ #include #include #endif +#include #include #include #ifdef _WIN32 #include -#else -#include #endif using namespace boost::filesystem; @@ -210,26 +214,18 @@ static void ProcessModels() { // Launch threaded OBJ file building //GenerateModelOBJThreaded(); //PrintModel(meshCollection.back()); -#ifdef _WIN32 - CreateDirectory(".\\objOut", NULL); -#else - mkdir("./objOut"); -#endif for ( RDI::HOB* hobFile : modelCollection ) { - if (hobFile->getObjectCount()) { - string parentPath = path(hobFile->getFullPath()).parent_path().filename().string(); + if (hobFile->isLoaded() && hobFile->getObjectCount()) { + string parentPath = path(hobFile->getFullPath()).string(); replace(parentPath.begin(), parentPath.end(), '/', '\\'); -#ifdef _WIN32 - CreateDirectory((".\\objOut\\" + parentPath).c_str(), NULL); -#else - mkdir(("./objOut/" + parentPath).c_str()); -#endif + filesystem::create_directories(".\\objOut\\" + hobFile->getFullPath()); for ( i = 0; i < hobFile->getObjectCount(); i++ ) { - cout << " Processing " << hobFile->getFullPath() << "..." << endl; + cout << hobFile->getFullPath() << "/" << *(hobFile->getObjectName(i)) << "..."; GenerateModelOBJ(hobFile->getMeshFromObject(i), parentPath, hobFile->getObjectName(i)); + cout << " OK" << endl; } } } @@ -288,12 +284,18 @@ int main( int argc, char *argv[] ) { for ( std::string lname : RDI::RDI_getLevelsName() ) { cout << " " << lname << endl; } + cout << endl << "> Models found: " << RDI::RDI_getModelsName().size() << endl; + auto t_start = chrono::high_resolution_clock::now(); ProcessModels(); + auto t_end = chrono::high_resolution_clock::now(); + cout << "Models processing in " << chrono::duration_cast(t_end - t_start).count() << "s" << endl; + cout << endl << "> Textures found: " << RDI::RDI_getTexturesName().size() << endl; for ( std::string txname : RDI::RDI_getTexturesName() ) { cout << " " << txname << endl; } + cout << endl << "> Musics found: " << RDI::RDI_getMusicsName().size() << endl; for ( std::string mname : RDI::RDI_getMusicsName() ) { cout << " " << mname << endl;