28 #include <unordered_set>
30 #include <boost/filesystem.hpp>
31 #include <boost/algorithm/string.hpp>
37 namespace fs = boost::filesystem;
56 auto order_file = dir /
"order.txt";
58 if (fs::exists(order_file)) {
63 size_t comment_pos = line.
find(
'#');
64 if (comment_pos != std::string::npos) {
65 line = line.
substr(0, comment_pos);
69 auto name = dir / line;
70 if (fs::exists(name)) {
71 result.emplace_back(name);
72 ordered_names.emplace(line);
74 logger.
warn() <<
"Unknown name " << line <<
" in order.txt of " << dir <<
" directory";
83 for (fs::directory_iterator iter {dir}; iter != fs::directory_iterator{}; ++ iter) {
84 if (ordered_names.count(iter->path().filename().string()) == 0) {
90 for (
auto& file : remaining_files){
91 result.emplace_back(file);
100 auto ordered_contents =
getOrder(dir);
101 for (
auto& name : ordered_contents) {
102 if (fs::is_directory(name)) {
104 result.insert(result.end(), sub_dir_contents.begin(), sub_dir_contents.end());
106 result.emplace_back(name);
126 if (!fs::exists(fspath)) {
132 if (fs::is_directory(fspath)) {
134 for (
auto& file : dir_contents) {
135 if (fs::is_regular_file(file) &&
m_parser->isDatasetFile(file.string()))
139 if (dataset_name.
empty()) {
152 auto ret =
m_name_file_map.insert(make_pair(qualified_name, file.string()));
157 <<
"in the map. Qualify name : "
158 << qualified_name.qualifiedName()
159 <<
" Path :" << file.string();
165 throw Elements::Exception() <<
" Root path : " << fspath.string() <<
" is not a directory!";
178 while (!my_group.
empty() && my_group.
back() ==
'/') {
183 if (!my_group.
empty() && pos != 0) {
184 my_group = my_group.
substr(pos);
186 if (!my_group.
empty()) {
196 if (boost::starts_with(qualified_name.qualifiedName(), my_group)) {
197 qualified_name_vector.
push_back(qualified_name);
201 return (qualified_name_vector);