Use error message routine that checks for headless mode.

Fixes https://gitlab.com/kicad/code/kicad/issues/13575
This commit is contained in:
Jeff Young 2023-01-19 00:18:11 +00:00
parent 0c2e550143
commit ae55b1581e
1 changed files with 9 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2020 Cirilo Bernardo <cirilo.bernardo@gmail.com> * Copyright (C) 2015-2020 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,12 +27,12 @@
#include <sstream> #include <sstream>
#include <wx/log.h> #include <wx/log.h>
#include <wx/msgdlg.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include "common.h" #include <common.h>
#include "filename_resolver.h" #include <filename_resolver.h>
#include <confirm.h>
#include <wx_filename.h> #include <wx_filename.h>
// configuration file version // configuration file version
@ -453,7 +453,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
wxString msg = _( "The given path does not exist" ); wxString msg = _( "The given path does not exist" );
msg.append( wxT( "\n" ) ); msg.append( wxT( "\n" ) );
msg.append( tpath.m_Pathvar ); msg.append( tpath.m_Pathvar );
wxMessageBox( msg, _( "3D model search path" ) ); DisplayErrorMessage( nullptr, msg );
} }
tpath.m_Pathexp.clear(); tpath.m_Pathexp.clear();
@ -478,7 +478,9 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
{ {
if( tpath.m_Alias == sPL->m_Alias ) if( tpath.m_Alias == sPL->m_Alias )
{ {
wxString msg = _( "Alias: " ); wxString msg = _( "Bad alias (duplicate name)" );
msg.append( wxT( "\n" ) );
msg.append( _( "Alias: " ) );
msg.append( tpath.m_Alias ); msg.append( tpath.m_Alias );
msg.append( wxT( "\n" ) ); msg.append( wxT( "\n" ) );
msg.append( _( "This path:" ) + wxS( " " ) ); msg.append( _( "This path:" ) + wxS( " " ) );
@ -486,7 +488,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
msg.append( wxT( "\n" ) ); msg.append( wxT( "\n" ) );
msg.append( _( "Existing path:" ) + wxS( " " ) ); msg.append( _( "Existing path:" ) + wxS( " " ) );
msg.append( sPL->m_Pathvar ); msg.append( sPL->m_Pathvar );
wxMessageBox( msg, _( "Bad alias (duplicate name)" ) ); DisplayErrorMessage( nullptr, msg );
return false; return false;
} }