DRC scripting: load project from board if possible
s_SettingsManager is not always initialized when the WriteDRCReport is run. We should first attempt to extract the project from the actual board being checked. Failing that, we fall back to the static settings manager and then exit if we don't have a project associated. Fixes https://gitlab.com/kicad/code/kicad/issues/10221
This commit is contained in:
parent
d014f0307b
commit
78e737b9d8
|
@ -457,7 +457,16 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
|
|||
|
||||
wxFileName fn = aBoard->GetFileName();
|
||||
fn.SetExt( DesignRulesFileExtension );
|
||||
wxString drcRulesPath = s_SettingsManager->Prj().AbsolutePath( fn.GetFullName() );
|
||||
PROJECT* prj = nullptr;
|
||||
|
||||
if( aBoard->GetProject() )
|
||||
prj = aBoard->GetProject();
|
||||
else if( s_SettingsManager )
|
||||
prj = &s_SettingsManager->Prj();
|
||||
|
||||
wxCHECK( prj, false );
|
||||
|
||||
wxString drcRulesPath = prj->AbsolutePath( fn.GetFullName() );
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue