39 #ifndef PCL_COMMON_FILE_IO_IMPL_HPP_
40 #define PCL_COMMON_FILE_IO_IMPL_HPP_
42 #include <boost/filesystem.hpp>
43 #include <boost/range/iterator_range.hpp>
56 boost::filesystem::path p(directory);
57 if(boost::filesystem::is_directory(p))
59 for(
const auto& entry : boost::make_iterator_range(boost::filesystem::directory_iterator(p), {}))
61 if (boost::filesystem::is_regular_file(entry))
63 if (entry.path().extension() ==
".pcd")
64 file_names.emplace_back(entry.path().filename().string());
70 std::cerr <<
"Given path is not a directory\n";
73 std::sort(file_names.begin(), file_names.end());
78 std::size_t filename_start = input.find_last_of(
'/',
static_cast<std::size_t
>(-1)) + 1;
79 return input.substr(filename_start, input.size()-filename_start);
84 std::size_t dot_position = input.find_last_of(
'.', input.size());
85 return input.substr(0, dot_position);
90 std::size_t dot_position = input.find_last_of(
'.', input.size());
91 return input.substr(dot_position+1, input.size());