diff --git a/wifi/estimate/ray3/OBJPool.h b/wifi/estimate/ray3/OBJPool.h index c8eea61..d76edaf 100644 --- a/wifi/estimate/ray3/OBJPool.h +++ b/wifi/estimate/ray3/OBJPool.h @@ -9,8 +9,9 @@ #include "Obstacle3.h" // LINUX ONLY -#include -#include +//#include +//#include +#include namespace Ray3D { @@ -42,19 +43,26 @@ namespace Ray3D { initDone = true; // LINUX ONLY! - DIR* d = opendir(folder.c_str()); - if (!d) {throw Exception("OBJPool: folder not found: " + folder);} + //DIR* d = opendir(folder.c_str()); + //if (!d) {throw Exception("OBJPool: folder not found: " + folder);} + std::experimental::filesystem::path d(folder); + if (!std::experimental::filesystem::exists(d)) { + throw Exception("OBJPool: folder not found: " + folder); + } - struct dirent *dir; - while ((dir = readdir(d)) != NULL) { - const std::string absFile = folder + "/" + dir->d_name; + //struct dirent *dir; + //while ((dir = readdir(d)) != NULL) { + for (std::experimental::filesystem::directory_entry entry : std::experimental::filesystem::directory_iterator(d)) { + //const std::string absFile = folder + "/" + dir->d_name; + const std::string absFile = entry.path().native(); if (endsWith(absFile, ".obj")) { - std::string name = std::string(dir->d_name); + //std::string name = std::string(dir->d_name); + std::string name = entry.path().filename(); name = name.substr(0, name.length() - 4); // without extension load(absFile, name); } } - closedir(d); + //closedir(d); } diff --git a/wifi/estimate/ray3/OBJReader.h b/wifi/estimate/ray3/OBJReader.h index c5b7316..a08a804 100644 --- a/wifi/estimate/ray3/OBJReader.h +++ b/wifi/estimate/ray3/OBJReader.h @@ -160,7 +160,7 @@ private: } // sanity check - if (numVertices != 3) {throw "this face is not a triangle!";} +// if (numVertices != 3) {throw "this face is not a triangle!";} }