We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
arduino
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent e1df9ca commit 685d59fCopy full SHA for 685d59f
arduino-core/src/processing/app/BaseNoGui.java
@@ -907,7 +907,14 @@ static public String sanitizeName(String origName) {
907
*/
908
static public void saveFile(String str, File file) throws IOException {
909
File temp = File.createTempFile(file.getName(), null, file.getParentFile());
910
- PApplet.saveStrings(temp, new String[] { str });
+ // Split the file content using minimum common separator \n
911
+ // then trim any other character (\r) so saveStrings can print it in the correct
912
+ // format for every OS
913
+ String strArray[] = str.split("\n");
914
+ for (String item : strArray) {
915
+ item.trim();
916
+ }
917
+ PApplet.saveStrings(temp, strArray);
918
919
try {
920
file = file.getCanonicalFile();
0 commit comments