Generate error dialog when a symbol library can't be found.

Fixes: lp:1789047
* https://bugs.launchpad.net/kicad/+bug/1789047
This commit is contained in:
Jeff Young 2018-09-17 18:00:19 +01:00
parent 99cb1471c3
commit 0b39b68d37
1 changed files with 14 additions and 1 deletions

View File

@ -26,7 +26,7 @@
#include <wx/mstream.h>
#include <wx/filename.h>
#include <wx/tokenzr.h>
#include <pgm_base.h>
#include <draw_graphic_text.h>
#include <kiway.h>
#include <kicad_string.h>
@ -60,6 +60,7 @@
#include <lib_text.h>
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
#include <symbol_lib_table.h> // for PropPowerSymsOnly definintion.
#include <confirm.h>
// Must be the first line of part library document (.dcm) files.
@ -2334,6 +2335,18 @@ void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart )
void SCH_LEGACY_PLUGIN_CACHE::Load()
{
if( !m_libFileName.FileExists() )
{
wxString msg = wxString::Format( _( "Library file \"%s\" not found.\n\n"
"Use the Manage Symbol Libraries dialog to fix the "
"path (or remove the library)." ),
m_libFileName.GetFullPath() );
KIDIALOG dlg( Pgm().App().GetTopWindow(), msg, KIDIALOG::KD_ERROR );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
dlg.ShowModal();
return;
}
wxCHECK_RET( m_libFileName.IsAbsolute(),
wxString::Format( "Cannot use relative file paths in legacy plugin to "
"open library \"%s\".", m_libFileName.GetFullPath() ) );