mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-14 13:02:39 -07: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:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user