4 #include "boost/filesystem/path.hpp"
5 #include "boost/filesystem/operations.hpp"
12 namespace bf = boost::filesystem;
14 if(fullPath.empty())
return false;
15 if(fullPath[0] !=
'/')
return false;
17 std::vector<std::string> pathElements =
edm::tokenize(fullPath,
"/");
18 for(
auto const&
path : pathElements) {
21 pathToResolve +=
path;
23 if (bf::is_symlink(bf::symlink_status(symLinkPath))) {
24 bf::path resolved = bf::read_symlink(symLinkPath);
27 if(!bf::exists(resolved)) {
31 auto begin = fullPath.begin();
32 auto end =
begin + pathToResolve.size();
34 if(resolvedPath[0] ==
'/') {
35 fullPath.replace(
begin,
end, resolvedPath);
37 fullPath.replace(
begin + 1,
end, resolvedPath);
49 bool found = resolveOneSymbolicLink(fullPath);
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
void resolveSymbolicLinks(std::string &fullPath)