From f95732a4bbff236cd67618cc0187b8b4368b25c8 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 30 Aug 2021 14:42:08 -0700 Subject: [PATCH] Generalize 4670309e Allows loading of multiple types of .gz extensioned files by extracting the second extension Fixes https://gitlab.com/kicad/code/kicad/issues/9047 --- 3d-viewer/3d_cache/3d_plugin_manager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/3d-viewer/3d_cache/3d_plugin_manager.cpp b/3d-viewer/3d_cache/3d_plugin_manager.cpp index 995667067e..cf9def2a29 100644 --- a/3d-viewer/3d_cache/3d_plugin_manager.cpp +++ b/3d-viewer/3d_cache/3d_plugin_manager.cpp @@ -414,10 +414,12 @@ SCENEGRAPH* S3D_PLUGIN_MANAGER::Load3DModel( const wxString& aFileName, std::str ext_to_find.MakeLower(); #endif - // When the extension is .gz, the actual extension should be .stp.gz; - // So ensure is ext is the expected extension - if( ext_to_find == "gz" && aFileName.Lower().EndsWith( ".stp.gz" ) ) - ext_to_find = "stp.gz"; + // .gz files are compressed versions that may have additional information in the previous extension + if( ext_to_find == "gz" ) + { + wxFileName second( raw.GetName() ); + ext_to_find = second.GetExt() + ".gz"; + } std::pair < std::multimap< const wxString, KICAD_PLUGIN_LDR_3D* >::iterator, std::multimap< const wxString, KICAD_PLUGIN_LDR_3D* >::iterator > items;