Add envVar and text variable resolution to plot directory paths.
Fixes https://gitlab.com/kicad/code/kicad/issues/3808
This commit is contained in:
parent
78159c6744
commit
b13559c926
|
@ -171,7 +171,7 @@ int COMMON_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetAssociatedDocument( m_frame, helpFile, &m_frame->Kiway().Prj() );
|
GetAssociatedDocument( m_frame, helpFile, &m_frame->Prj() );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ protected:
|
||||||
wxString filename = GetValue();
|
wxString filename = GetValue();
|
||||||
|
|
||||||
if( !filename.IsEmpty() && filename != wxT( "~" ) )
|
if( !filename.IsEmpty() && filename != wxT( "~" ) )
|
||||||
GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Kiway().Prj() );
|
GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Prj() );
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_SHIM* m_dlg;
|
DIALOG_SHIM* m_dlg;
|
||||||
|
@ -336,7 +336,7 @@ protected:
|
||||||
if( path.IsEmpty() )
|
if( path.IsEmpty() )
|
||||||
path = *m_currentDir;
|
path = *m_currentDir;
|
||||||
else
|
else
|
||||||
path = ExpandEnvVarSubstitutions( path, &m_dlg->Kiway().Prj() );
|
path = ExpandEnvVarSubstitutions( path, &m_dlg->Prj() );
|
||||||
|
|
||||||
if( m_ext )
|
if( m_ext )
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ protected:
|
||||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||||
{
|
{
|
||||||
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET );
|
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET );
|
||||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Kiway().Prj() );
|
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
*
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -155,10 +154,9 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||||
*/
|
*/
|
||||||
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// Build the absolute path of current output plot directory
|
// Build the absolute path of current output directory to preselect it in the file browser.
|
||||||
// to preselect it when opening the dialog.
|
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
|
||||||
wxFileName fn( m_outputDirectoryName->GetValue() );
|
path = Prj().AbsolutePath( path );
|
||||||
wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
|
|
||||||
|
|
||||||
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
||||||
|
|
||||||
|
@ -167,7 +165,7 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
|
||||||
|
|
||||||
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
||||||
|
|
||||||
fn = Prj().AbsolutePath( g_RootSheet->GetFileName() );
|
wxFileName fn( Prj().AbsolutePath( g_RootSheet->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 ) );
|
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
|
||||||
|
@ -352,13 +350,12 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxTextCtrl* aOutputDirectoryName,
|
wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxString& aPlotFileName,
|
||||||
wxString& aPlotFileName,
|
|
||||||
wxString& aExtension,
|
wxString& aExtension,
|
||||||
REPORTER* aReporter )
|
REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
wxString outputDirName = aOutputDirectoryName->GetValue();
|
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
|
||||||
wxFileName outputDir = wxFileName::DirName( outputDirName );
|
wxFileName outputDir = wxFileName::DirName( path );
|
||||||
|
|
||||||
wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT( "." ) + aExtension);
|
wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT( "." ) + aExtension);
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
*
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -141,15 +140,12 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file name with an absolute path name
|
* Create a file name with an absolute path name
|
||||||
* @param aOutputDirectoryName the directory name to plot, this can be a relative name of the
|
|
||||||
* current project directory or an absolute directory name.
|
|
||||||
* @param aPlotFileName the name for the file to plot without a path
|
* @param aPlotFileName the name for the file to plot without a path
|
||||||
* @param aExtension the extension for the file to plot
|
* @param aExtension the extension for the file to plot
|
||||||
* @param aReporter a point to a REPORTER object use to show messages (can be NULL)
|
* @param aReporter a point to a REPORTER object use to show messages (can be NULL)
|
||||||
* @return the created file name
|
* @return the created file name
|
||||||
* @throw IO_ERROR on file I/O errors
|
* @throw IO_ERROR on file I/O errors
|
||||||
*/
|
*/
|
||||||
wxFileName createPlotFileName( wxTextCtrl* aOutputDirectoryName,
|
wxFileName createPlotFileName( wxString& aPlotFileName, wxString& aExtension,
|
||||||
wxString& aPlotFileName,
|
REPORTER* aReporter = NULL );
|
||||||
wxString& aExtension, REPORTER* aReporter = NULL );
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -691,7 +691,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
||||||
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
else if (event.GetId() == MYID_SHOW_DATASHEET )
|
||||||
{
|
{
|
||||||
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET, FDC_VALUE );
|
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET, FDC_VALUE );
|
||||||
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Kiway().Prj() );
|
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -649,8 +649,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
pglayout.SetEmptyLayout();
|
pglayout.SetEmptyLayout();
|
||||||
|
|
||||||
BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks";
|
BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks";
|
||||||
wxFileName layoutfn( Kiway().Prj().GetProjectPath(),
|
wxFileName layoutfn( Prj().GetProjectPath(), BASE_SCREEN::m_PageLayoutDescrFileName );
|
||||||
BASE_SCREEN::m_PageLayoutDescrFileName );
|
|
||||||
wxFile layoutfile;
|
wxFile layoutfile;
|
||||||
|
|
||||||
if( layoutfile.Create( layoutfn.GetFullPath() ) )
|
if( layoutfile.Create( layoutfn.GetFullPath() ) )
|
||||||
|
@ -659,9 +658,9 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
layoutfile.Close();
|
layoutfile.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
projectpath = Kiway().Prj().GetProjectPath();
|
projectpath = Prj().GetProjectPath();
|
||||||
newfilename.SetPath( Prj().GetProjectPath() );
|
newfilename.SetPath( projectpath );
|
||||||
newfilename.SetName( Prj().GetProjectName() );
|
newfilename.SetName( projectpath );
|
||||||
newfilename.SetExt( LegacySchematicFileExtension );
|
newfilename.SetExt( LegacySchematicFileExtension );
|
||||||
|
|
||||||
g_CurrentSheet->clear();
|
g_CurrentSheet->clear();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
* Copyright (C) 1992-2010 Lorenzo Marcantonio
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -72,8 +72,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
|
wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
|
||||||
wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
|
wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
ext, &reporter );
|
|
||||||
|
|
||||||
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
|
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
|
||||||
aPlotFrameRef ) )
|
aPlotFrameRef ) )
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 Jean-Pierre Charras jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2010 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -142,8 +142,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
|
wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
ext, &reporter );
|
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 Jean-Pierre Charras jp.charras at wanadoo.fr
|
* Copyright (C) 1992-2010 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -87,7 +87,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
{
|
{
|
||||||
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
|
wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
|
||||||
plotFileName = createPlotFileName( m_outputDirectoryName, fname, ext, &reporter );
|
plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
|
|
||||||
if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
|
if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -91,8 +91,6 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
|
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
|
|
||||||
wxString outputDirName = m_outputDirectoryName->GetValue();
|
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
REPORTER& reporter = m_MessagesBox->Reporter();
|
REPORTER& reporter = m_MessagesBox->Reporter();
|
||||||
|
|
||||||
|
@ -100,8 +98,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
{
|
{
|
||||||
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
|
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
fname, ext, &reporter );
|
|
||||||
|
|
||||||
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aDefaultLineWidth, plotPage,
|
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aDefaultLineWidth, plotPage,
|
||||||
plot_offset, scale, aPlotFrameRef ) )
|
plot_offset, scale, aPlotFrameRef ) )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -66,8 +66,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
|
||||||
{
|
{
|
||||||
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||||
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
fname, ext, &reporter );
|
|
||||||
|
|
||||||
bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aDefaultLineWidth,
|
bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aDefaultLineWidth,
|
||||||
getModeColor() ? false : true, aPrintFrameRef );
|
getModeColor() ? false : true, aPrintFrameRef );
|
||||||
|
|
|
@ -292,21 +292,19 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
|
||||||
|
|
||||||
void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// Build the absolute path of current output plot directory
|
// Build the absolute path of current output directory to preselect it in the file browser.
|
||||||
// to preselect it when opening the dialog.
|
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
|
||||||
wxFileName fn( m_outputDirectoryName->GetValue() );
|
path = Prj().AbsolutePath( path );
|
||||||
wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
|
|
||||||
|
|
||||||
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
||||||
|
|
||||||
if( dirDialog.ShowModal() == wxID_CANCEL )
|
if( dirDialog.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
||||||
|
wxFileName fn( Prj().AbsolutePath( m_board->GetFileName() ) );
|
||||||
fn = Prj().AbsolutePath( m_board->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 ) );
|
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
|
||||||
|
|
||||||
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
||||||
|
@ -378,7 +376,8 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
||||||
|
|
||||||
// Create output directory if it does not exist (also transform it in
|
// Create output directory if it does not exist (also transform it in
|
||||||
// absolute form). Bail if it fails
|
// absolute form). Bail if it fails
|
||||||
wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
|
wxString path = ExpandEnvVarSubstitutions( m_plotOpts.GetOutputDirectory(), &Prj() );
|
||||||
|
wxFileName outputDir = wxFileName::DirName( path );
|
||||||
wxString boardFilename = m_board->GetFileName();
|
wxString boardFilename = m_board->GetFileName();
|
||||||
|
|
||||||
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||||
|
@ -399,8 +398,8 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
||||||
excellonWriter.SetRouteModeForOvalHoles( m_UseRouteModeForOvalHoles );
|
excellonWriter.SetRouteModeForOvalHoles( m_UseRouteModeForOvalHoles );
|
||||||
excellonWriter.SetMapFileFormat( filefmt[choice] );
|
excellonWriter.SetMapFileFormat( filefmt[choice] );
|
||||||
|
|
||||||
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(),
|
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap,
|
||||||
aGenDrill, aGenMap, &reporter );
|
&reporter );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -427,7 +426,8 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
||||||
fn.SetName( fn.GetName() + wxT( "-drl" ) );
|
fn.SetName( fn.GetName() + wxT( "-drl" ) );
|
||||||
fn.SetExt( ReportFileExtension );
|
fn.SetExt( ReportFileExtension );
|
||||||
|
|
||||||
wxString defaultPath = Prj().AbsolutePath( m_plotOpts.GetOutputDirectory() );
|
wxString defaultPath = ExpandEnvVarSubstitutions( m_plotOpts.GetOutputDirectory(), &Prj() );
|
||||||
|
defaultPath = Prj().AbsolutePath( defaultPath );
|
||||||
|
|
||||||
if( defaultPath.IsEmpty() )
|
if( defaultPath.IsEmpty() )
|
||||||
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
||||||
|
|
|
@ -346,10 +346,9 @@ void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// Build the absolute path of current output plot directory
|
// Build the absolute path of current output directory to preselect it in the file browser.
|
||||||
// to preselect it when opening the dialog.
|
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
|
||||||
wxFileName fn( m_outputDirectoryName->GetValue() );
|
path = Prj().AbsolutePath( path );
|
||||||
wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
|
|
||||||
|
|
||||||
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
||||||
|
|
||||||
|
@ -358,7 +357,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
||||||
|
|
||||||
fn = Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() );
|
wxFileName fn( Prj().AbsolutePath( m_parent->GetBoard()->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\"" ),
|
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ),
|
||||||
|
@ -752,7 +751,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
||||||
|
|
||||||
// Create output directory if it does not exist (also transform it in
|
// Create output directory if it does not exist (also transform it in
|
||||||
// absolute form). Bail if it fails
|
// absolute form). Bail if it fails
|
||||||
wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
|
wxString path = ExpandEnvVarSubstitutions( m_plotOpts.GetOutputDirectory(), &Prj() );
|
||||||
|
wxFileName outputDir = wxFileName::DirName( path );
|
||||||
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
||||||
REPORTER& reporter = m_messagesPanel->Reporter();
|
REPORTER& reporter = m_messagesPanel->Reporter();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue