Pcbnew: fix incorrect filenames when plotting layers
This commit is contained in:
parent
3688bae75f
commit
4794d3774a
|
@ -108,11 +108,13 @@ static wxString GetGerberExtension( int layer )/*{{{*/
|
||||||
}
|
}
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
/** Complete a plot filename: forces the output directory, add a suffix to the name
|
/* Complete a plot filename: forces the output directory,
|
||||||
and sets the extension if specified */
|
* add a suffix to the name and sets the specified extension
|
||||||
static void BuildPlotFileName( wxFileName *aFilename, /*{{{*/
|
* the suffix is usually the layer name
|
||||||
|
*/
|
||||||
|
static void BuildPlotFileName( wxFileName *aFilename,
|
||||||
const wxString& aOutputDir,
|
const wxString& aOutputDir,
|
||||||
wxString aSuffix,
|
const wxString& aSuffix,
|
||||||
const wxString& aExtension )
|
const wxString& aExtension )
|
||||||
{
|
{
|
||||||
aFilename->SetPath( aOutputDir );
|
aFilename->SetPath( aOutputDir );
|
||||||
|
@ -121,17 +123,21 @@ static void BuildPlotFileName( wxFileName *aFilename, /*{{{*/
|
||||||
aFilename->SetExt( aExtension );
|
aFilename->SetExt( aExtension );
|
||||||
|
|
||||||
/* remove leading and trailing spaces if any from the suffix, if
|
/* remove leading and trailing spaces if any from the suffix, if
|
||||||
something survives add it to the name; also the suffix can contain
|
something survives add it to the name;
|
||||||
an extension: if that's the case, apply it */
|
also the suffix can contain some not allowed chars in filename (/ \ .),
|
||||||
aSuffix.Trim( true ); aSuffix.Trim( false );
|
so change them to underscore
|
||||||
|
*/
|
||||||
|
wxString suffix = aSuffix;
|
||||||
|
suffix.Trim( true );
|
||||||
|
suffix.Trim( false );
|
||||||
|
|
||||||
wxFileName suffix_fn( aSuffix );
|
suffix.Replace( wxT("."), wxT("_") );
|
||||||
|
suffix.Replace( wxT("/"), wxT("_") );
|
||||||
|
suffix.Replace( wxT("\\"), wxT("_") );
|
||||||
|
|
||||||
if( suffix_fn.HasName() )
|
if( !suffix.IsEmpty() )
|
||||||
aFilename->SetName( aFilename->GetName() + wxT( "-" ) + suffix_fn.GetName() );
|
aFilename->SetName( aFilename->GetName() + wxT( "-" ) + suffix );
|
||||||
if( suffix_fn.HasExt() )
|
}
|
||||||
aFilename->SetExt( suffix_fn.GetExt() );
|
|
||||||
}/*}}}*/
|
|
||||||
|
|
||||||
/** Fix the output directory pathname to absolute and ensure it exists */
|
/** Fix the output directory pathname to absolute and ensure it exists */
|
||||||
static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
|
static bool EnsureOutputDirectory( wxFileName *aOutputDir, /*{{{*/
|
||||||
|
|
Loading…
Reference in New Issue