We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20bfb17 commit c96cdd7Copy full SHA for c96cdd7
arduino-core/src/processing/app/BaseNoGui.java
@@ -940,7 +940,14 @@ static public String sanitizeName(String origName) {
940
*/
941
static public void saveFile(String str, File file) throws IOException {
942
File temp = File.createTempFile(file.getName(), null, file.getParentFile());
943
- PApplet.saveStrings(temp, new String[] { str });
+ // Split the file content using minimum common separator \n
944
+ // then trim any other character (\r) so saveStrings can print it in the correct
945
+ // format for every OS
946
+ String strArray[] = str.split("\n");
947
+ for (String item : strArray) {
948
+ item.trim();
949
+ }
950
+ PApplet.saveStrings(temp, strArray);
951
952
try {
953
file = file.getCanonicalFile();
0 commit comments