Always use the project directory for default save

Fixes https://gitlab.com/kicad/code/kicad/issues/10478
This commit is contained in:
Seth Hillbrand 2022-01-20 11:50:21 -08:00
parent 323a069738
commit dd7029ea07
2 changed files with 12 additions and 3 deletions

View File

@ -34,6 +34,8 @@
#include <wx/menu.h>
#include <wx/textctrl.h>
#include <kiplatform/ui.h>
#include <kiway_holder.h>
#include <project.h>
WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style ) :
@ -352,7 +354,14 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
wxFileName fn;
if( m_reportFileName.empty() )
fn = wxT( "./report.txt" );
{
fn = wxT( "report.txt" );
KIWAY_HOLDER* parent = dynamic_cast<KIWAY_HOLDER*>( m_parent );
if( parent )
fn.SetPath( parent->Prj().GetProjectPath() );
}
else
fn = m_reportFileName;

View File

@ -642,9 +642,9 @@ void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
{
wxFileName fn( "./DRC." + ReportFileExtension );
wxFileName fn( "DRC." + ReportFileExtension );
wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
wxFileDialog dlg( this, _( "Save Report to File" ), Prj().GetProjectPath(), fn.GetFullName(),
ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() != wxID_OK )