Use KICAD_DATA to find stock libraries on Linux

Use the KICAD_DATA build-time variable to determine the default stock
library search path on Linux instead of relying on DEFAULT_INSTALL_PATH
in combination with hardcoded folder names. The search logic for Windows
and macOS is refactored but remains unchanged.
This commit is contained in:
Marcus A. Romer 2021-03-20 16:44:03 +01:00 committed by Jon Evans
parent e9eb5a5e21
commit c291162567
3 changed files with 9 additions and 14 deletions

View File

@ -55,8 +55,6 @@ Linux install tree
${prefix}/share/kicad/modules/packages3d - 3D component models (.wrl and .step format). ${prefix}/share/kicad/modules/packages3d - 3D component models (.wrl and .step format).
${prefix}/share/kicad/resources - Resource files (images, etc). ${prefix}/share/kicad/resources - Resource files (images, etc).
KiCad searches for the libraries, templates, 3D models, etc. bin/../share.
Warning: Warning:
Do not change the KiCad tree, or the location of binary files. Otherwise Do not change the KiCad tree, or the location of binary files. Otherwise
KiCad may not be able to find some or all of its required files. KiCad may not be able to find some or all of its required files.

View File

@ -281,19 +281,10 @@ bool PGM_BASE::InitPgm()
return false; return false;
wxFileName baseSharePath; wxFileName baseSharePath;
#if defined( __WXMSW__ ) #ifdef __WXMAC__
// Make the paths relative to the executable dir as KiCad might be installed anywhere baseSharePath.AssignDir( PATHS::GetOSXKicadMachineDataDir() );
// It follows the Windows installer paths scheme, where binaries are installed in
// PATH/bin and extra files in PATH/share/kicad
baseSharePath.AssignDir( m_bin_dir + "\\.." );
baseSharePath.Normalize();
#else #else
baseSharePath.AssignDir( wxString( wxT( DEFAULT_INSTALL_PATH ) ) ); baseSharePath.AssignDir( PATHS::GetStockDataPath( false ) );
#endif
#if !defined( __WXMAC__ )
baseSharePath.AppendDir( "share" );
baseSharePath.AppendDir( "kicad" );
#endif #endif
// KICAD6_FOOTPRINT_DIR // KICAD6_FOOTPRINT_DIR

View File

@ -67,6 +67,12 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack )
// Use as second ranked place. // Use as second ranked place.
maybe.AddPaths( wxT( DEFAULT_INSTALL_PATH ) ); maybe.AddPaths( wxT( DEFAULT_INSTALL_PATH ) );
#ifdef __WXGTK__
// On Linux, the stock data install path is defined by KICAD_DATA.
// Useful when multiple versions of KiCad are installed in parallel.
maybe.AddPaths( PATHS::GetStockDataPath( false ) );
#endif
// Add the directory for the user-dependent, program specific data files. // Add the directory for the user-dependent, program specific data files.
// According to wxWidgets documentation: // According to wxWidgets documentation:
// Unix: ~/.appname // Unix: ~/.appname