1177{
1178 for (const auto &path : p) {
1179 std::filesystem::path absolute_path;
1180
1181 if (path.empty() || path == ".")
1182 absolute_path = root;
1183 else if (std::filesystem::path{path}.is_relative())
1184 absolute_path = root / path;
1185 else
1186 absolute_path = path;
1187
1188 bool match_successful{false};
1189 for (auto &resolved_glob_path :
1190 glob::glob(absolute_path.string(), true)) {
1191 try {
1192 auto resolved_absolute_path = absolute(resolved_glob_path);
1193 resolved_absolute_path =
1194 canonical(resolved_absolute_path.lexically_normal());
1195
1196 resolved_absolute_path.make_preferred();
1197
1198 LOG_DBG(
"Added path {} to paths_filter",
1199 resolved_absolute_path.string());
1200
1201 paths_.emplace_back(std::move(resolved_absolute_path));
1202
1203 match_successful = true;
1204 }
1205 catch (std::filesystem::filesystem_error &e) {
1206 LOG_WARN(
"Cannot add non-existent path {} to "
1207 "paths filter",
1208 absolute_path.string());
1209 continue;
1210 }
1211 }
1212
1213 if (!match_successful)
1214 LOG_WARN(
"Paths filter pattern '{}' did not match "
1215 "any files relative to '{}'",
1216 path,
root_.string());
1217 }
1218}