From 01cb1543bb6b69e5719a78375514234de23f1749 Mon Sep 17 00:00:00 2001 From: Mojca Miklavec Date: Sun, 3 Mar 2024 20:29:44 +0100 Subject: [PATCH] Change the platform detection order Make sure that windows-specific getWindowsKiCadRoot() is only called on Windows --- common/paths.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/common/paths.cpp b/common/paths.cpp index 966cf95e42..48b698f7b9 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -295,12 +295,16 @@ wxString PATHS::GetStockPlugins3DPath() { wxFileName fn; -#ifdef __WXGTK__ - // 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" ) ); +#if defined( __WXMSW__ ) + if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) + { + fn.AssignDir( getWindowsKiCadRoot() ); + } + else + { + fn.AssignDir( GetExecutablePath() ); + } + fn.AppendDir( wxT( "plugins" ) ); #elif defined( __WXMAC__ ) fn.Assign( wxStandardPaths::Get().GetPluginsDir(), wxEmptyString ); @@ -323,15 +327,11 @@ wxString PATHS::GetStockPlugins3DPath() fn.AppendDir( wxT( "PlugIns" ) ); } #else - if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) - { - fn.AssignDir( getWindowsKiCadRoot() ); - } - else - { - fn.AssignDir( GetExecutablePath() ); - } - + // 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