Fix Eagle project import bug on Linux.

There is a significant difference in the behavior of wxFileDialog
between Windows and Linux (GTK+).  On windows, wxFileDialog will
return the path chosen even if no file is selected.  On Linux,
wxFileDialog returns the default path when no file is selected.  This
caused the destination path to be the same path as the source which
was causing the issue.  Use wxDirDialog instead so the selected path
is returned.

Fixes lp:1732759

https://bugs.launchpad.net/kicad/+bug/1732759
This commit is contained in:
Wayne Stambaugh 2017-11-18 12:28:59 -05:00
parent ff5ee05def
commit 753f24aaaa
1 changed files with 4 additions and 3 deletions

View File

@ -85,11 +85,12 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
wxString protitle = _( "KiCad Project Destination" );
wxFileDialog prodlg( this, protitle, pro.GetPath(), pro.GetFullName(),
ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
// Don't use wxFileDialog here. On GTK builds, the default path is returned unless a
// file is actually selected.
wxDirDialog prodlg( this, protitle, pro.GetPath(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( prodlg.ShowModal() == wxID_CANCEL )
return;
return;
pro.SetPath( prodlg.GetPath() );