We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31a26cb commit 3e50aeeCopy full SHA for 3e50aee
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