Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ set_target_properties(${PROJECT_NAME}_plugin PROPERTIES
COMPILE_FLAGS "${OpenRAVE_CXX_FLAGS}"
LINK_FLAGS "${OpenRAVE_LINK_FLAGS}"
LIBRARY_OUTPUT_DIRECTORY
"${CATKIN_DEVEL_PREFIX}/lib/openrave-${OpenRAVE_LIBRARY_SUFFIX}")
"${CATKIN_DEVEL_PREFIX}/share/openrave-${OpenRAVE_LIBRARY_SUFFIX}/plugins")
target_link_libraries("${PROJECT_NAME}_plugin"
${catkin_LIBRARIES}
${TinyXML2_LIBRARIES}
Expand All @@ -57,6 +57,6 @@ if(CATKIN_ENABLE_TESTING)
endif(CATKIN_ENABLE_TESTING)

install(TARGETS "${PROJECT_NAME}_plugin"
LIBRARY DESTINATION "lib/openrave-${OpenRAVE_LIBRARY_SUFFIX}"
LIBRARY DESTINATION "share/openrave-${OpenRAVE_LIBRARY_SUFFIX}/plugins"
)

65 changes: 36 additions & 29 deletions src/boostfs_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,43 @@ namespace boost
namespace filesystem3
#endif
{
template < >
path& path::append< typename path::iterator >( typename path::iterator begin, typename path::iterator end, const codecvt_type& cvt)
{
for( ; begin != end ; ++begin )
*this /= *begin;
return *this;
}
#if BOOST_VERSION > 106000
// From Boost 1.60+ there is a built-in function for this (boost::filesystem::relative).
boost::filesystem::path make_relative(boost::filesystem::path a_From, boost::filesystem::path a_To)
{
return boost::filesystem::relative(a_From, a_To);
}
#else
template < >
path& path::append< typename path::iterator >( typename path::iterator begin, typename path::iterator end, const codecvt_type& cvt)
{
for( ; begin != end ; ++begin )
*this /= *begin;
return *this;
}

// Return path when appended to a_From will resolve to same as a_To
boost::filesystem::path make_relative( boost::filesystem::path a_From, boost::filesystem::path a_To )
{
a_From = boost::filesystem::absolute( a_From ); a_To = boost::filesystem::absolute( a_To );
boost::filesystem::path ret;
boost::filesystem::path::const_iterator itrFrom( a_From.begin() ), itrTo( a_To.begin() );

// Find common base
for( boost::filesystem::path::const_iterator toEnd( a_To.end() ), fromEnd( a_From.end() ) ;
itrFrom != fromEnd && itrTo != toEnd && *itrFrom == *itrTo; ++itrFrom, ++itrTo );

// Navigate backwards in directory to reach previously found base
for( boost::filesystem::path::const_iterator fromEnd( a_From.end() ); itrFrom != fromEnd; ++itrFrom ) {
if( (*itrFrom) != "." )
ret /= "..";
}

// Now navigate down the directory branch
ret.append( itrTo, a_To.end() );
return ret;
}
// Return path when appended to a_From will resolve to same as a_To
boost::filesystem::path make_relative( boost::filesystem::path a_From, boost::filesystem::path a_To )
{
a_From = boost::filesystem::absolute( a_From ); a_To = boost::filesystem::absolute( a_To );
boost::filesystem::path ret;
boost::filesystem::path::const_iterator itrFrom( a_From.begin() ), itrTo( a_To.begin() );

// Find common base
for( boost::filesystem::path::const_iterator toEnd( a_To.end() ), fromEnd( a_From.end() ) ;
itrFrom != fromEnd && itrTo != toEnd && *itrFrom == *itrTo; ++itrFrom, ++itrTo );

// Navigate backwards in directory to reach previously found base
for( boost::filesystem::path::const_iterator fromEnd( a_From.end() ); itrFrom != fromEnd; ++itrFrom ) {
if( (*itrFrom) != "." )
ret /= "..";
}

// Now navigate down the directory branch
ret.append( itrTo, a_To.end() );
return ret;
}
#endif
}
}