MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / isSupportedFileInSubfolders

Function isSupportedFileInSubfolders

source/MRMesh/MRObjectLoad.cpp:494–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492
493
494bool isSupportedFileInSubfolders( const std::filesystem::path& folder )
495{
496 const auto allFilters = getAllFilters();
497
498 std::vector<std::filesystem::path> filesList;
499 filesList.push_back( folder );
500
501 while ( !filesList.empty() )
502 {
503 auto path = filesList[0];
504 filesList.erase( filesList.begin() );
505
506 std::error_code ec;
507 for ( auto entry : Directory{ path, ec } )
508 {
509 auto subpath = entry.path();
510 if ( entry.is_directory( ec ) )
511 {
512 filesList.push_back( path = subpath );
513 }
514 else if ( entry.is_regular_file( ec ) )
515 {
516 auto ext = utf8string( subpath.extension() );
517 for ( auto& c : ext )
518 c = ( char )tolower( c );
519
520 if ( ext.empty() )
521 continue;
522
523 if ( findFilter( allFilters, ext ) )
524 return true;
525 }
526 }
527 }
528 return false;
529}
530
531Expected<LoadedObject> loadSceneFromAnySupportedFormat( const std::filesystem::path& path, const ProgressCallback& callback )
532{

Callers 1

openDirectoryMethod · 0.85

Calls 7

getAllFiltersFunction · 0.85
utf8stringFunction · 0.85
findFilterFunction · 0.85
push_backMethod · 0.80
eraseMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected