MCPcopy Index your code
hub / github.com/benfry/processing4 / load

Method load

app/src/processing/app/SketchCode.java:281–311  ·  view source on GitHub ↗

Load this piece of code from a file.

()

Source from the content-addressed store, hash-verified

279 * Load this piece of code from a file.
280 */
281 public void load() throws IOException {
282 program = Util.loadFile(file);
283
284 if (program == null) {
285 System.err.println("There was a problem loading " + file);
286 System.err.println("This may happen because you don't have permissions to read the file, or the file has gone missing.");
287 throw new IOException("Cannot read or access " + file);
288 }
289
290 // Remove NUL characters because they'll cause problems,
291 // and their presence is very difficult to debug.
292 // https://github.com/processing/processing/issues/1973
293 if (program.indexOf('\0') != -1) {
294 program = program.replaceAll("\0", "");
295 }
296 savedProgram = program;
297
298 // This used to be the "Fix Encoding and Reload" warning, but since that
299 // tool has been removed, let's ramble about text editors and encodings.
300 if (program.indexOf('\uFFFD') != -1) {
301 System.err.println(file.getName() + " contains unrecognized characters.");
302 System.err.println("You should re-open " + file.getName() +
303 " with a text editor,");
304 System.err.println("and re-save it in UTF-8 format. Otherwise, you can");
305 System.err.println("delete the bad characters to get rid of this warning.");
306 System.err.println();
307 }
308
309 setLastModified();
310 setModified(false);
311 }
312
313
314 /**

Callers 2

SketchCodeMethod · 0.95
addBreakpointCommentsMethod · 0.95

Calls 6

loadFileMethod · 0.95
setLastModifiedMethod · 0.95
setModifiedMethod · 0.95
printlnMethod · 0.45
replaceAllMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected