Skip to content

Commit 95f8d3e

Browse files
authored
replace deprecated boost filesystem basename (#5901)
* replace deprecated boost filesystem basename * try to address CI clang-tidy issues * address CI clang-tidy issues * fix Windows build errors
1 parent 17d983a commit 95f8d3e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ main (int argc, char** argv)
440440
{
441441
pcl::TextureMapping<pcl::PointXYZ>::Camera cam;
442442
readCamPoseFile(it->path ().string (), cam);
443-
cam.texture_file = boost::filesystem::basename (it->path ()) + ".png";
443+
cam.texture_file = it->path ().stem ().string () + ".png";
444444
my_cams.push_back (cam);
445445
}
446446
}

io/src/image_grabber.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles (const std::string
269269
{
270270
extension = boost::algorithm::to_upper_copy (boost::filesystem::extension (itr->path ()));
271271
pathname = itr->path ().string ();
272-
basename = boost::filesystem::basename (itr->path ());
272+
basename = itr->path ().stem ().string ();
273273
if (!boost::filesystem::is_directory (itr->status ())
274274
&& isValidExtension (extension))
275275
{
@@ -312,7 +312,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles (const std::string
312312
{
313313
extension = boost::algorithm::to_upper_copy (boost::filesystem::extension (itr->path ()));
314314
pathname = itr->path ().string ();
315-
basename = boost::filesystem::basename (itr->path ());
315+
basename = itr->path ().stem ().string ();
316316
if (!boost::filesystem::is_directory (itr->status ())
317317
&& isValidExtension (extension))
318318
{
@@ -327,7 +327,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadDepthAndRGBFiles (const std::string
327327
{
328328
extension = boost::algorithm::to_upper_copy (boost::filesystem::extension (itr->path ()));
329329
pathname = itr->path ().string ();
330-
basename = boost::filesystem::basename (itr->path ());
330+
basename = itr->path ().stem ().string ();
331331
if (!boost::filesystem::is_directory (itr->status ())
332332
&& isValidExtension (extension))
333333
{
@@ -368,7 +368,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::loadPCLZFFiles (const std::string &dir)
368368
{
369369
extension = boost::algorithm::to_upper_copy (boost::filesystem::extension (itr->path ()));
370370
pathname = itr->path ().string ();
371-
basename = boost::filesystem::basename (itr->path ());
371+
basename = itr->path ().stem ().string ();
372372
if (!boost::filesystem::is_directory (itr->status ())
373373
&& isValidExtension (extension))
374374
{
@@ -429,7 +429,7 @@ pcl::ImageGrabberBase::ImageGrabberImpl::getTimestampFromFilepath (
429429
{
430430
// For now, we assume the file is of the form frame_[22-char POSIX timestamp]_*
431431
char timestamp_str[256];
432-
int result = std::sscanf (boost::filesystem::basename (filepath).c_str (),
432+
int result = std::sscanf (boost::filesystem::path (filepath).stem ().string ().c_str (),
433433
"frame_%22s_%*s",
434434
timestamp_str);
435435
if (result > 0)
@@ -971,7 +971,7 @@ pcl::ImageGrabberBase::getCurrentDepthFileName () const
971971
pathname = impl_->depth_pclzf_files_[impl_->cur_frame_];
972972
else
973973
pathname = impl_->depth_image_files_[impl_->cur_frame_];
974-
std::string basename = boost::filesystem::basename (pathname);
974+
std::string basename = boost::filesystem::path (pathname).stem ().string ();
975975
return (basename);
976976
}
977977
//////////////////////////////////////////////////////////////////////////////////////////
@@ -983,7 +983,7 @@ pcl::ImageGrabberBase::getPrevDepthFileName () const
983983
pathname = impl_->depth_pclzf_files_[impl_->cur_frame_-1];
984984
else
985985
pathname = impl_->depth_image_files_[impl_->cur_frame_-1];
986-
std::string basename = boost::filesystem::basename (pathname);
986+
std::string basename = boost::filesystem::path (pathname).stem ().string ();
987987
return (basename);
988988
}
989989

@@ -996,7 +996,7 @@ pcl::ImageGrabberBase::getDepthFileNameAtIndex (std::size_t idx) const
996996
pathname = impl_->depth_pclzf_files_[idx];
997997
else
998998
pathname = impl_->depth_image_files_[idx];
999-
std::string basename = boost::filesystem::basename (pathname);
999+
std::string basename = boost::filesystem::path (pathname).stem ().string ();
10001000
return (basename);
10011001
}
10021002

outofcore/include/pcl/outofcore/impl/octree_base.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ namespace pcl
9393
root_node_->m_tree_ = this;
9494

9595
// Set the path to the outofcore octree metadata (unique to the root folder) ending in .octree
96-
boost::filesystem::path treepath = root_name.parent_path () / (boost::filesystem::basename (root_name) + TREE_EXTENSION_);
96+
boost::filesystem::path treepath = root_name.parent_path () / (root_name.stem ().string () + TREE_EXTENSION_);
9797

9898
//Load the JSON metadata
9999
metadata_->loadMetadataFromDisk (treepath);
@@ -169,7 +169,7 @@ namespace pcl
169169
root_node_->m_tree_ = this;
170170

171171
// Set root nodes file path
172-
boost::filesystem::path treepath = dir / (boost::filesystem::basename (root_name) + TREE_EXTENSION_);
172+
boost::filesystem::path treepath = dir / (root_name.stem ().string () + TREE_EXTENSION_);
173173

174174
//fill the fields of the metadata
175175
metadata_->setCoordinateSystem (coord_sys);

outofcore/include/pcl/outofcore/impl/octree_base_node.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ namespace pcl
19371937
template<typename ContainerT, typename PointT> void
19381938
OutofcoreOctreeBaseNode<ContainerT, PointT>::convertToXYZRecursive ()
19391939
{
1940-
std::string fname = boost::filesystem::basename (node_metadata_->getPCDFilename ()) + std::string (".dat.xyz");
1940+
std::string fname = node_metadata_->getPCDFilename ().stem ().string () + ".dat.xyz";
19411941
boost::filesystem::path xyzfile = node_metadata_->getDirectoryPathname () / fname;
19421942
payload_->convertToXYZ (xyzfile);
19431943

0 commit comments

Comments
 (0)