From e48811189cb2c895e2710e566285c01d36d92487 Mon Sep 17 00:00:00 2001 From: Jon Evans <jon@craftyjon.com> Date: Sun, 7 Nov 2021 12:35:00 -0500 Subject: [PATCH] Fix PCM and plugin loading for namespaced plugins --- kicad/pcm/pcm_task_manager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kicad/pcm/pcm_task_manager.cpp b/kicad/pcm/pcm_task_manager.cpp index da09f9f14e..bb7c1962b0 100644 --- a/kicad/pcm/pcm_task_manager.cpp +++ b/kicad/pcm/pcm_task_manager.cpp @@ -194,6 +194,10 @@ bool PCM_TASK_MANAGER::extract( const wxString& aFilePath, const wxString& aPack return false; } + // Namespace delimiter changed on disk to allow flat loading of Python modules + wxString clean_package_id = aPackageId; + clean_package_id.Replace( '.', '_' ); + for( ; entry; entry = zip.GetNextEntry() ) { wxArrayString path_parts = @@ -214,7 +218,7 @@ bool PCM_TASK_MANAGER::extract( const wxString& aFilePath, const wxString& aPack // <PackageRoot>/$folder/$contents // To // $KICAD6_3RD_PARTY/$folder/$package_id/$contents - path_parts.Insert( aPackageId, 1 ); + path_parts.Insert( clean_package_id, 1 ); path_parts.Insert( m_pcm->Get3rdPartyPath(), 0 ); wxString fullname = wxJoin( path_parts, wxFileName::GetPathSeparator(), (wxChar) NULL ); @@ -343,11 +347,15 @@ void PCM_TASK_MANAGER::InstallFromFile( wxWindow* aParent, const wxString& aFile void PCM_TASK_MANAGER::deletePackageDirectories( const wxString& aPackageId ) { + // Namespace delimiter changed on disk to allow flat loading of Python modules + wxString clean_package_id = aPackageId; + clean_package_id.Replace( '.', '_' ); + for( const wxString& dir : PCM_PACKAGE_DIRECTORIES ) { wxFileName d( m_pcm->Get3rdPartyPath(), "" ); d.AppendDir( dir ); - d.AppendDir( aPackageId ); + d.AppendDir( clean_package_id ); if( d.DirExists() ) {