From 0d2f50e38dddf2f0c23ca4b4dcfc2fbb9d20cf89 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 23 Jan 2026 10:49:09 -0800 Subject: [PATCH] Ensure 3d model plugins respect the flags KICAD_RUN_FROM_BUILD_DIR should prevent ABI-incompatible plugins from being loaded --- common/paths.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/common/paths.cpp b/common/paths.cpp index 700f6d14e2..251dfc380d 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -382,12 +382,21 @@ wxString PATHS::GetStockPlugins3DPath() fn.AppendDir( wxT( "PlugIns" ) ); } #else - // KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path - // corresponding to the install path used for constructing KICAD_USER_PLUGIN - wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR ); - fn.Assign( tfname, "" ); - fn.AppendDir( wxT( "kicad" ) ); - fn.AppendDir( wxT( "plugins" ) ); + if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) + { + fn.Assign( wxStandardPaths::Get().GetExecutablePath() ); + fn.AppendDir( wxT( ".." ) ); + fn.AppendDir( wxT( "plugins" ) ); + } + else + { + // KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path + // corresponding to the install path used for constructing KICAD_USER_PLUGIN + wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR ); + fn.Assign( tfname, "" ); + fn.AppendDir( wxT( "kicad" ) ); + fn.AppendDir( wxT( "plugins" ) ); + } #endif fn.AppendDir( wxT( "3d" ) );