Eeschema: Verify path can be made relative before asking in plotter dialog
CHANGED: When the output path is set in the plotter dialog, the user is asked if they want to make the path relative to the project. The old code would ask the user if they wanted to do this, and then if it failed would present an error dialog. The new code tries it first on a copy, and only if it works does the user get asked if they want to do it. Related to issue https://gitlab.com/kicad/code/kicad/issues/5263 except that is for Pcbnew, and this fixes the same problem in Eeschema. Issue 5263 is fixed with Merge Request: https://gitlab.com/kicad/code/kicad/-/merge_requests/370
This commit is contained in:
parent
dad3101107
commit
9cda3dbff5
|
@ -156,17 +156,20 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
|
||||||
wxFileName fn( Prj().AbsolutePath( m_parent->Schematic().Root().GetFileName() ) );
|
wxFileName fn( Prj().AbsolutePath( m_parent->Schematic().Root().GetFileName() ) );
|
||||||
wxString defaultPath = fn.GetPathWithSep();
|
wxString defaultPath = fn.GetPathWithSep();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
|
wxFileName relPathTest; // Used to test if we can make the path relative
|
||||||
|
|
||||||
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
relPathTest.Assign( dirDialog.GetPath() );
|
||||||
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
|
||||||
|
|
||||||
// relative directory selected
|
// Test if making the path relative is possible before asking the user if they want to do it
|
||||||
if( dialog.ShowModal() == wxID_YES )
|
if( relPathTest.MakeRelativeTo( defaultPath ) )
|
||||||
{
|
{
|
||||||
if( !dirName.MakeRelativeTo( defaultPath ) )
|
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
|
||||||
wxMessageBox( _( "Cannot make path relative (target volume different from file "
|
|
||||||
"volume)!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
|
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
||||||
|
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
||||||
|
|
||||||
|
if( dialog.ShowModal() == wxID_YES )
|
||||||
|
dirName.MakeRelativeTo( defaultPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
|
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
|
||||||
|
|
Loading…
Reference in New Issue