| 106 | return key; |
| 107 | } |
| 108 | bool IsAncestorOf(std::string_view ancestor, std::string_view descendant) { |
| 109 | // See filesystem/path_util.h |
| 110 | ancestor = RemoveTrailingSlash(ancestor); |
| 111 | if (ancestor == "") return true; |
| 112 | descendant = RemoveTrailingSlash(descendant); |
| 113 | if (!descendant.starts_with(ancestor)) return false; |
| 114 | descendant.remove_prefix(ancestor.size()); |
| 115 | if (descendant.empty()) return true; |
| 116 | return descendant.front() == '/'; |
| 117 | } |
| 118 | |
| 119 | Forest MakeForest(std::vector<FileInfo>* infos) { |
| 120 | std::sort(infos->begin(), infos->end(), FileInfo::ByPath); |
no test coverage detected