------------------------------------------------------------------------
| 295 | |
| 296 | //------------------------------------------------------------------------ |
| 297 | void findFilesWithExt (const filesystem::path& path, const std::string& ext, |
| 298 | Module::PathList& pathList, bool recursive = true) |
| 299 | { |
| 300 | for (auto& p : filesystem::directory_iterator (path)) |
| 301 | { |
| 302 | #if USE_FILESYSTEM |
| 303 | filesystem::path finalPath (p); |
| 304 | if (isFolderSymbolicLink (p)) |
| 305 | { |
| 306 | if (auto res = resolveShellLink (p)) |
| 307 | { |
| 308 | finalPath = *res; |
| 309 | if (!filesystem::exists (finalPath)) |
| 310 | continue; |
| 311 | } |
| 312 | else |
| 313 | continue; |
| 314 | } |
| 315 | const auto& cpExt = finalPath.extension (); |
| 316 | if (cpExt == ext) |
| 317 | { |
| 318 | filesystem::path vstPath (finalPath); |
| 319 | if (checkVST3Package (vstPath)) |
| 320 | { |
| 321 | pathList.push_back (vstPath.generic_string ()); |
| 322 | continue; |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | if (filesystem::is_directory (finalPath)) |
| 327 | { |
| 328 | if (recursive) |
| 329 | findFilesWithExt (finalPath, ext, pathList, recursive); |
| 330 | } |
| 331 | else if (cpExt == ext) |
| 332 | pathList.push_back (finalPath.generic_string ()); |
| 333 | #else |
| 334 | const auto& cp = p.path (); |
| 335 | const auto& cpExt = cp.extension (); |
| 336 | if (cpExt == ext) |
| 337 | { |
| 338 | if ((p.status ().type () == filesystem::file_type::directory) || |
| 339 | isFolderSymbolicLink (p)) |
| 340 | { |
| 341 | filesystem::path finalPath (p); |
| 342 | if (checkVST3Package (finalPath)) |
| 343 | { |
| 344 | pathList.push_back (finalPath.generic_u8string ()); |
| 345 | continue; |
| 346 | } |
| 347 | findFilesWithExt (cp, ext, pathList, recursive); |
| 348 | } |
| 349 | else |
| 350 | pathList.push_back (cp.generic_u8string ()); |
| 351 | } |
| 352 | else if (recursive) |
| 353 | { |
| 354 | if (p.status ().type () == filesystem::file_type::directory) |
no test coverage detected