39 #ifndef PCL_COMMON_FILE_IO_IMPL_HPP_
40 #define PCL_COMMON_FILE_IO_IMPL_HPP_
50 if((dp = opendir(directory.c_str())) == NULL) {
51 std::cerr <<
"Could not open directory.\n";
54 while ((dirp = readdir(dp)) != NULL) {
55 if (dirp->d_type == DT_REG)
57 std::string file_name = dirp->d_name;
58 if (file_name.substr(file_name.size()-4, 4)==
".pcd")
59 file_names.push_back(dirp->d_name);
63 std::sort(file_names.begin(), file_names.end());
71 size_t filename_start = input.find_last_of(
'/', static_cast<size_t>(-1)) + 1;
72 return input.substr(filename_start, input.size()-filename_start);
77 size_t dot_position = input.find_last_of(
'.', input.size());
78 return input.substr(0, dot_position);
83 size_t dot_position = input.find_last_of(
'.', input.size());
84 return input.substr(dot_position+1, input.size());
std::string getFilenameWithoutPath(const std::string &input)
Remove the path from the given string and return only the filename (the remaining string after the la...
This file defines compatibility wrappers for low level I/O functions.
void getAllPcdFilesInDirectory(const std::string &directory, std::vector< std::string > &file_names)
Find all *.pcd files in the directory and return them sorted.
std::string getFilenameWithoutExtension(const std::string &input)
Remove the extension from the given string and return only the filename (everything before the last '...
std::string getFileExtension(const std::string &input)
Get the file extension from the given string (the remaining string after the last '...