From 593aa2dc12e24d6da43512ebb22eabe83793a3f7 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Fri, 15 Nov 2013 08:36:11 -0600 Subject: [PATCH] Show KISYSMOD in DIALOG_FP_LIB_TABLE even if it has not been referenced by a URI. --- common/edaappl.cpp | 10 ++++++---- common/fp_lib_table.cpp | 6 ++++++ include/fp_lib_table.h | 10 ++++++++++ pcbnew/dialogs/dialog_fp_lib_table.cpp | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 7a218868df..e8d138e58f 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -51,6 +51,7 @@ #include #include #include +#include static const wxChar* CommonConfigPath = wxT( "kicad_common" ); @@ -1160,19 +1161,20 @@ bool EDA_APP::LockFile( const wxString& fileName ) bool EDA_APP::SetFootprintLibTablePath() { - wxString path; + wxString path; + wxString kisysmod = FP_LIB_TABLE::GlobalPathEnvVariableName(); // Set the KISYSMOD environment variable for the current process if it is not already // defined in the user's environment. This is required to expand the global footprint // library table paths. - if( wxGetEnv( wxT( "KISYSMOD" ), &path ) && wxFileName::DirExists( path ) ) + if( wxGetEnv( kisysmod, &path ) && wxFileName::DirExists( path ) ) return true; // Set the KISYSMOD environment variable to the path defined in the user's configuration // if it is defined and the path exists. if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) ) { - wxSetEnv( wxT( "KISYSMOD" ), path ); + wxSetEnv( kisysmod, path ); return true; } @@ -1198,7 +1200,7 @@ bool EDA_APP::SetFootprintLibTablePath() if( modFileCount != 0 ) { - wxSetEnv( wxT( "KISYSMOD" ), bestPath ); + wxSetEnv( kisysmod, bestPath ); return true; } } diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index d3ee4ca41a..e1e704ff22 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -734,6 +734,12 @@ const wxString FP_LIB_TABLE::ProjectPathEnvVariableName() } +const wxString FP_LIB_TABLE::GlobalPathEnvVariableName() +{ + return wxT( "KISYSMOD" ); +} + + wxString FP_LIB_TABLE::GetProjectFileName( const wxFileName& aPath ) { wxFileName fn = aPath; diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 6d77459806..e18a1cf5ae 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -574,6 +574,16 @@ public: */ static const wxString ProjectPathEnvVariableName(); + /** + * Function GlobalPathEnvVarVariableName + * returns the name of the environment variable used to hold the directory of + * locally installed "KiCad sponsored" system footprint libraries. These can + * be either legacy or pretty format. The only thing special about this + * particular environment variable is that it is set automatically by + * KiCad on program startup, iff it is not set already in the environment. + */ + static const wxString GlobalPathEnvVariableName(); + static wxString GetProjectFileName( const wxFileName& aPath ); /** diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 49a39de6c0..3c72ff204e 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -696,6 +696,7 @@ private: // not used yet. It is automatically set by KiCad to the directory holding // the current project. unique.insert( FP_LIB_TABLE::ProjectPathEnvVariableName() ); + unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() ); m_path_subs_grid->AppendRows( unique.size() );