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

Function makeObjectTreeFromZip

source/MRViewer/MROpenObjects.cpp:268–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268Expected<LoadedObject> makeObjectTreeFromZip( const std::filesystem::path& zipPath, const ProgressCallback& callback )
269{
270 UniqueTemporaryFolder tmpFolder;
271 auto contentsFolder = tmpFolder / zipPath.stem();
272
273 std::ifstream in( zipPath, std::ifstream::binary );
274 if ( !in )
275 return unexpected( std::string( "Cannot open file for reading " ) + utf8string( zipPath.filename() ) );
276
277 std::error_code ec;
278 std::filesystem::create_directory( contentsFolder, ec );
279 auto resZip = decompressZip( in, contentsFolder );
280 if ( !resZip )
281 return unexpected( "ZIP container error: " + resZip.error() );
282
283 return makeObjectTreeFromFolder( contentsFolder, false, callback );
284}
285
286MR_ADD_SCENE_LOADER( IOFilter( "ZIP files (.zip)","*.zip" ), makeObjectTreeFromZip )
287

Callers

nothing calls this directly

Calls 5

utf8stringFunction · 0.85
decompressZipFunction · 0.85
makeObjectTreeFromFolderFunction · 0.85
errorMethod · 0.80
unexpectedFunction · 0.50

Tested by

no test coverage detected