Skip to content

Commit

Permalink
Fix boost::filesystem::path::append
Browse files Browse the repository at this point in the history
  • Loading branch information
furushchev authored and k-okada committed Feb 15, 2025
1 parent ec4f401 commit aad1106
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/nodelet/face_recognition_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,13 @@ namespace filesystem3
namespace filesystem
{
#endif
template <>
path& path::append<typename path::iterator>(typename path::iterator lhs, typename path::iterator rhs,
const codecvt_type& cvt)
{
for (; lhs != rhs; ++lhs)
*this /= *lhs;
return *this;
}
path user_expanded_path(const path& p)
{
path::const_iterator it(p.begin());
if (p.size() < 2)
return p;

auto it = p.begin();
// Replace the tilda with the home directory
std::string user_dir = (*it).string();
if (user_dir.length() == 0 || user_dir[0] != '~')
return p;
Expand All @@ -121,8 +117,15 @@ path user_expanded_path(const path& p)
return p;
homedir = pw->pw_dir;
}

// Append the rest of path
ret = path(std::string(homedir));
return ret.append(++it, p.end(), path::codecvt());
++it;
for (; it != p.end(); ++it)
{
ret /= *it;
}
return ret;
}
} // namespace filesystem
} // namespace boost
Expand Down

0 comments on commit aad1106

Please sign in to comment.