PANEL_SYM_LIB_TABLE: fix a bug in filenames from wxFileDialog dialog.
We want the full path, so use GetPaths. GetFilenames sometimes return the full path in wxWidgets 3.1.7, not always the filename Fixes #11821 https://gitlab.com/kicad/code/kicad/issues/11821
This commit is contained in:
parent
5327b10064
commit
c79dd09464
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2021 CERN
|
||||
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -505,12 +505,11 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
wxString detailedMsg = _( "One of the nicknames will need to be changed after "
|
||||
"adding this library." );
|
||||
|
||||
wxArrayString files;
|
||||
dlg.GetFilenames( files );
|
||||
wxArrayString filePathsList;
|
||||
dlg.GetPaths( filePathsList );
|
||||
|
||||
for( const wxString& file : files )
|
||||
for( const wxString& filePath : filePathsList )
|
||||
{
|
||||
wxString filePath = dlg.GetDirectory() + wxFileName::GetPathSeparator() + file;
|
||||
wxFileName fn( filePath );
|
||||
wxString nickname = LIB_ID::FixIllegalChars( fn.GetName(), true );
|
||||
bool doAdd = true;
|
||||
|
@ -556,7 +555,7 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
if( !files.IsEmpty() )
|
||||
if( !filePathsList.IsEmpty() )
|
||||
{
|
||||
m_cur_grid->MakeCellVisible( m_cur_grid->GetNumberRows() - 1, 0 );
|
||||
m_cur_grid->SetGridCursor( m_cur_grid->GetNumberRows() - 1, 1 );
|
||||
|
|
Loading…
Reference in New Issue