static void loadExcludes(std::set<std::string> & x, const bf::path & ePath) { using namespace bf; if (!exists(ePath)) throw std::logic_error(fmt::format("exclude file list path doesn't exists '{}'", ePath.string())); std::ifstream f( ePath.c_str() ); if (!f.is_open()) throw std::logic_error(fmt::format("error while opening exclude list file '{}'", ePath.string())); std::string line; while(getline(f, line)) { line = boost::trim_copy(line); if (line.empty()) continue; x.insert(line); } if (f.bad()) throw std::logic_error(fmt::format("error while reading exclude list file '{}'", ePath.string())); }
bf::path makeRel(const bf::path & root, const bf::path & path) { auto iRoot = root.begin(); const auto iRootEnd = root.end(); const auto iPathEnd = path.end(); bf::path res; for (auto iPath = path.begin(); iPath != iPathEnd; ++iPath) { if (iRoot != iRootEnd) { assert( (*iRoot) == (*iPath) ); iRoot++; } else { res /= (*iPath); } } return res; }
bool FileSystemTree::addNode( const bf::path &path, const EntityType &type ) { std::string pathStr = path.string(); if( checkAndhandlePath(pathStr) ) { mTree.put(bpt::ptree::path_type{ pathStr, SEPARATOR }, Node( path, type) ); return true; } return false; }
~download_content() { if (local_file_!=target_file_ && delete_temp_file_) unlink(local_file_.c_str()); }
bf::path remove_trailing_path_separator(const bf::path& in_path) { string path_str = in_path.native(); return bf::path(remove_trailing_path_separator(path_str)); }