MCPcopy Index your code
hub / github.com/processing/processing / load

Method load

app/src/processing/app/SketchCode.java:283–313  ·  view source on GitHub ↗

Load this piece of code from a file.

()

Source from the content-addressed store, hash-verified

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

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