Change the platform detection order

Make sure that windows-specific getWindowsKiCadRoot() is only called on Windows
This commit is contained in:
Mojca Miklavec 2024-03-03 20:29:44 +01:00 committed by Jon Evans
parent d904535a15
commit 01cb1543bb
1 changed files with 15 additions and 15 deletions

View File

@ -295,12 +295,16 @@ wxString PATHS::GetStockPlugins3DPath()
{ {
wxFileName fn; wxFileName fn;
#ifdef __WXGTK__ #if defined( __WXMSW__ )
// KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
// corresponding to the install path used for constructing KICAD_USER_PLUGIN {
wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR ); fn.AssignDir( getWindowsKiCadRoot() );
fn.Assign( tfname, "" ); }
fn.AppendDir( wxT( "kicad" ) ); else
{
fn.AssignDir( GetExecutablePath() );
}
fn.AppendDir( wxT( "plugins" ) ); fn.AppendDir( wxT( "plugins" ) );
#elif defined( __WXMAC__ ) #elif defined( __WXMAC__ )
fn.Assign( wxStandardPaths::Get().GetPluginsDir(), wxEmptyString ); fn.Assign( wxStandardPaths::Get().GetPluginsDir(), wxEmptyString );
@ -323,15 +327,11 @@ wxString PATHS::GetStockPlugins3DPath()
fn.AppendDir( wxT( "PlugIns" ) ); fn.AppendDir( wxT( "PlugIns" ) );
} }
#else #else
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) // KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path
{ // corresponding to the install path used for constructing KICAD_USER_PLUGIN
fn.AssignDir( getWindowsKiCadRoot() ); wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR );
} fn.Assign( tfname, "" );
else fn.AppendDir( wxT( "kicad" ) );
{
fn.AssignDir( GetExecutablePath() );
}
fn.AppendDir( wxT( "plugins" ) ); fn.AppendDir( wxT( "plugins" ) );
#endif #endif