X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fconfigurationpaths.cpp;fp=src%2Fconfigurationpaths.cpp;h=b0d86abb0b7c33af28d221e6560f9982b448bc56;hb=6e77ef4f748bdfa40505fc11c0a190e7a40fdb46;hp=f4b15c9e7b83eb0465cb62010a91b81640b7e683;hpb=2a5eacb98767390d52a14c272318912160d3fec6;p=ric-plt%2Fsdl.git diff --git a/src/configurationpaths.cpp b/src/configurationpaths.cpp index f4b15c9..b0d86ab 100644 --- a/src/configurationpaths.cpp +++ b/src/configurationpaths.cpp @@ -21,9 +21,7 @@ #include "config.h" #include "private/configurationpaths.hpp" -#include -#include -#include +#include #include using namespace shareddatalayer; @@ -32,19 +30,17 @@ namespace { void findConfigurationFilesFromDirectory(const std::string& path, std::vector& paths) { - try + DIR *dir; struct dirent *diread; + if ((dir = opendir(path.c_str())) != nullptr) { - for(const auto& i : boost::make_iterator_range(boost::filesystem::directory_iterator(path), { })) + while ((diread = readdir(dir)) != nullptr) { - const auto filename(i.path().filename().native()); - if ((!boost::filesystem::is_directory(i.path())) && - (filename[0] != '.') && - (boost::algorithm::ends_with(filename, ".json"))) - paths.push_back(i.path().native()); + if ((diread->d_type == DT_REG) && + (diread->d_name[0] != '.') && + (boost::algorithm::ends_with(diread->d_name, ".json"))) + paths.push_back(std::string(diread->d_name)); } - } - catch (const boost::filesystem::filesystem_error &) - { + closedir (dir); } } }