| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9eb63c1 commit b040160
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -162,12 +162,11 @@ static public String loadFile(File file) throws IOException { | |||
| 162 | 162 | * Spew the contents of a String object out to a file. As of 3.0 beta 2, | |
| 163 | 163 | * this will replace and write \r\n for newlines on Windows. | |
| 164 | 164 | * https://github.com/processing/processing/issues/3455 | |
| 165 | + * As of 3.3.7, this puts a newline at the end of the file, | ||
| 166 | + * per good practice/POSIX: https://stackoverflow.com/a/729795 | ||
| 165 | 167 | */ | |
| 166 | - static public void saveFile(String str, File file) throws IOException { | ||
| 167 | - if (Platform.isWindows()) { | ||
| 168 | - String[] lines = str.split("\\r?\\n"); | ||
| 169 | - str = PApplet.join(lines, "\r\n"); | ||
| 170 | - } | ||
| 168 | + static public void saveFile(String text, File file) throws IOException { | ||
| 169 | + String[] lines = text.split("\\r?\\n"); | ||
| 171 | 170 | File temp = File.createTempFile(file.getName(), null, file.getParentFile()); | |
| 172 | 171 | try { | |
| 173 | 172 | // fix from cjwant to prevent symlinks from being destroyed. | |
@@ -178,9 +177,11 @@ static public void saveFile(String str, File file) throws IOException { | |||
| 178 | 177 | throw new IOException("Could not resolve canonical representation of " + | |
| 179 | 178 | file.getAbsolutePath()); | |
| 180 | 179 | } | |
| 181 | - // Can't use saveStrings() here b/c Windows will add a ^M to the file | ||
| 180 | + // Could use saveStrings(), but the we wouldn't be able to checkError() | ||
| 182 | 181 | PrintWriter writer = PApplet.createWriter(temp); | |
| 183 | - writer.print(str); | ||
| 182 | + for (String line : lines) { | ||
| 183 | + writer.println(line); | ||
| 184 | + } | ||
| 184 | 185 | boolean error = writer.checkError(); // calls flush() | |
| 185 | 186 | writer.close(); // attempt to close regardless | |
| 186 | 187 | if (error) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,11 @@ X menu bars broken in High Sierra | |||
| 9 | 9 | X https://github.com/processing/processing/issues/5272 | |
| 10 | 10 | X no more responses, had to close | |
| 11 | 11 | ||
| 12 | + _ change up the newline handling | ||
| 13 | + _ https://github.com/processing/processing/issues/5327 | ||
| 14 | + _ explanation: https://stackoverflow.com/a/729795 | ||
| 15 | + _ http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 | ||
| 16 | + | ||
| 12 | 17 | jakub | |
| 13 | 18 | X Fix scrub comments for empty block comment /**/ | |
| 14 | 19 | X https://github.com/processing/processing/pull/5265 | |
@@ -56,8 +61,6 @@ _ windows defender blocks processing 3.3.6 | |||
| 56 | 61 | _ https://github.com/processing/processing/issues/5329 | |
| 57 | 62 | _ Rename dialog is unusable on high density screen | |
| 58 | 63 | _ https://github.com/processing/processing/issues/5368 | |
| 59 | - _ change up the newline handling | ||
| 60 | - _ https://github.com/processing/processing/issues/5327 | ||
| 61 | 64 | _ Manager fails to complete install of PythonMode when no windows open | |
| 62 | 65 | _ https://github.com/processing/processing/issues/5309 | |
| 63 | 66 | _ update to launch4j 3.11? | |
| Back | FazBrowse Home | New Git URL |
0 commit comments