| 657 | }; |
| 658 | |
| 659 | Expected<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 | |
| 676 | Expected<std::vector<std::future<Expected<void>>>> Object::serializeRecursive_( const std::filesystem::path& path, Json::Value& root, int childId, |
| 677 | MapSharedObjects* mapSharedObjects ) const |
no test coverage detected