diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index b6e3240d5c..ac0bd475e3 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -493,7 +493,7 @@ bool PGM_BASE::InitPgm() tmpFileName.AppendDir( wxT( "modules" ) ); envVarItem.SetDefinedExternally( false ); } - envVarItem.SetValue( tmpFileName.GetFullPath() ); + envVarItem.SetValue( tmpFileName.GetPath() ); m_local_env_vars[ envVarName ] = envVarItem; // KISYS3DMOD @@ -524,7 +524,7 @@ bool PGM_BASE::InitPgm() tmpFileName.AppendDir( wxT( "template" ) ); envVarItem.SetDefinedExternally( false ); } - envVarItem.SetValue( tmpFileName.GetFullPath() ); + envVarItem.SetValue( tmpFileName.GetPath() ); m_local_env_vars[ envVarName ] = envVarItem; // KICAD_SYMBOLS @@ -540,7 +540,7 @@ bool PGM_BASE::InitPgm() tmpFileName.AppendDir( wxT( "library" ) ); envVarItem.SetDefinedExternally( false ); } - envVarItem.SetValue( tmpFileName.GetFullPath() ); + envVarItem.SetValue( tmpFileName.GetPath() ); m_local_env_vars[ envVarName ] = envVarItem; ReadPdfBrowserInfos(); // needs m_common_settings diff --git a/eeschema/dialogs/dialog_symbol_remap.cpp b/eeschema/dialogs/dialog_symbol_remap.cpp index 4810adc2fd..3c43fcbb09 100644 --- a/eeschema/dialogs/dialog_symbol_remap.cpp +++ b/eeschema/dialogs/dialog_symbol_remap.cpp @@ -157,25 +157,43 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter ) if( fullFileName.IsEmpty() ) fullFileName = lib->GetFullFileName(); - msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ), - libName, fullFileName ); - aReporter.Report( msg, REPORTER::RPT_INFO ); + wxFileName tmpFn = fullFileName; - prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName, pluginType ) ); + // Don't add symbol libraries that do not exist. + if( tmpFn.Normalize() && tmpFn.FileExists() ) + { + msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ), + libName, fullFileName ); + aReporter.Report( msg, REPORTER::RPT_INFO ); + + prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName, + pluginType ) ); + } + else + { + msg.Printf( _( "Library '%s' not found." ), fullFileName ); + aReporter.Report( msg, REPORTER::RPT_WARNING ); + } } - wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() ); + // Don't save empty project symbol library table. + if( !prjLibTable.IsEmpty() ) + { + wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() ); - try - { - FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() ); - prjLibTable.Format( &formatter, 0 ); - } - catch( const IO_ERROR& ioe ) - { - msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ), - ioe.What() ); - aReporter.Report( msg, REPORTER::RPT_ERROR ); + try + { + FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() ); + prjLibTable.Format( &formatter, 0 ); + } + catch( const IO_ERROR& ioe ) + { + msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ), + ioe.What() ); + aReporter.Report( msg, REPORTER::RPT_ERROR ); + } + + aReporter.Report( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO ); } } } diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 8f20a77845..12412b078b 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -153,6 +153,7 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) // Force a reload of the PART_LIBS prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL ); prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL ); + prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL ); // Update the schematic symbol library links. SCH_SCREENS schematic; @@ -232,6 +233,7 @@ void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) // Force a reload of the PART_LIBS prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL ); prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL ); + prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL ); // Update the schematic symbol library links. SCH_SCREENS schematic;