mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Fixed G-code export of custom G-code sections to not add a newline
if the custom G-code already ends with a newline.
This commit is contained in:
parent
b54a15faa2
commit
bb2b180ecc
2 changed files with 4 additions and 6 deletions
|
@ -264,11 +264,14 @@ inline void write(FILE *file, const std::string &what)
|
|||
fwrite(what.data(), 1, what.size(), file);
|
||||
}
|
||||
|
||||
// Write a string into a file. Add a newline, if the string does not end with a newline already.
|
||||
// Used to export a custom G-code section processed by the PlaceholderParser.
|
||||
inline void writeln(FILE *file, const std::string &what)
|
||||
{
|
||||
if (! what.empty()) {
|
||||
write(file, what);
|
||||
fprintf(file, "\n");
|
||||
if (what.back() != '\n')
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue