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

Method serializeRecursive

source/MRMesh/MRObject.cpp:659–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657};
658
659Expected<std::vector<std::future<Expected<void>>>> Object::serializeRecursive( const std::filesystem::path& path, Json::Value& root, int childId ) const
660{
661 // collect links to shared models
662 MapSharedObjects links{ .rootFolder = path };
663 const auto countSharedFiles = collectLinks( *this, links.map );
664 if ( countSharedFiles > 0 )
665 {
666 // create shared folder
667 const std::filesystem::path sharedFolder = path / cSharedFolder;
668 std::error_code ec;
669 if ( !std::filesystem::is_directory( sharedFolder, ec ) )
670 if ( !std::filesystem::create_directories( sharedFolder, ec ) )
671 return unexpected( "Cannot create directories " + utf8string( sharedFolder ) );
672 }
673 return serializeRecursive_( path, root, childId, countSharedFiles > 0 ? &links : nullptr );
674}
675
676Expected<std::vector<std::future<Expected<void>>>> Object::serializeRecursive_( const std::filesystem::path& path, Json::Value& root, int childId,
677 MapSharedObjects* mapSharedObjects ) const

Callers 1

serializeObjectTreeFunction · 0.80

Calls 4

collectLinksFunction · 0.85
utf8stringFunction · 0.85
unexpectedFunction · 0.70
create_directoriesFunction · 0.50

Tested by

no test coverage detected