From 753f24aaaa80d9928b780149e98d2f2ed1788abc Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 18 Nov 2017 12:28:59 -0500 Subject: [PATCH] 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 --- kicad/import_project.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index d702138380..b8470663aa 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -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() );