Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
4794d377
Commit
4794d377
authored
Nov 15, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: fix incorrect filenames when plotting layers
parent
3688bae7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
pcbplot.cpp
pcbnew/pcbplot.cpp
+21
-15
No files found.
pcbnew/pcbplot.cpp
View file @
4794d377
...
...
@@ -108,11 +108,13 @@ static wxString GetGerberExtension( int layer )/*{{{*/
}
}
/*}}}*/
/** Complete a plot filename: forces the output directory, add a suffix to the name
and sets the extension if specified */
static
void
BuildPlotFileName
(
wxFileName
*
aFilename
,
/*{{{*/
/* Complete a plot filename: forces the output directory,
* add a suffix to the name and sets the specified extension
* the suffix is usually the layer name
*/
static
void
BuildPlotFileName
(
wxFileName
*
aFilename
,
const
wxString
&
aOutputDir
,
wxString
aSuffix
,
const
wxString
&
aSuffix
,
const
wxString
&
aExtension
)
{
aFilename
->
SetPath
(
aOutputDir
);
...
...
@@ -121,17 +123,21 @@ static void BuildPlotFileName( wxFileName *aFilename, /*{{{*/
aFilename
->
SetExt
(
aExtension
);
/* remove leading and trailing spaces if any from the suffix, if
something survives add it to the name; also the suffix can contain
an extension: if that's the case, apply it */
aSuffix
.
Trim
(
true
);
aSuffix
.
Trim
(
false
);
wxFileName
suffix_fn
(
aSuffix
);
if
(
suffix_fn
.
HasName
()
)
aFilename
->
SetName
(
aFilename
->
GetName
()
+
wxT
(
"-"
)
+
suffix_fn
.
GetName
()
);
if
(
suffix_fn
.
HasExt
()
)
aFilename
->
SetExt
(
suffix_fn
.
GetExt
()
);
}
/*}}}*/
something survives add it to the name;
also the suffix can contain some not allowed chars in filename (/ \ .),
so change them to underscore
*/
wxString
suffix
=
aSuffix
;
suffix
.
Trim
(
true
);
suffix
.
Trim
(
false
);
suffix
.
Replace
(
wxT
(
"."
),
wxT
(
"_"
)
);
suffix
.
Replace
(
wxT
(
"/"
),
wxT
(
"_"
)
);
suffix
.
Replace
(
wxT
(
"
\\
"
),
wxT
(
"_"
)
);
if
(
!
suffix
.
IsEmpty
()
)
aFilename
->
SetName
(
aFilename
->
GetName
()
+
wxT
(
"-"
)
+
suffix
);
}
/** Fix the output directory pathname to absolute and ensure it exists */
static
bool
EnsureOutputDirectory
(
wxFileName
*
aOutputDir
,
/*{{{*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment