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

Method ensureExistence

app/src/processing/app/Sketch.java:1516–1542  ·  view source on GitHub ↗

Make sure the sketch hasn't been moved or deleted by a nefarious user. If they did, try to re-create it and save. Only checks whether the main folder is still around, but not its contents.

()

Source from the content-addressed store, hash-verified

1514 * main folder is still around, but not its contents.
1515 */
1516 public void ensureExistence() {
1517 if (!folder.exists()) {
1518 // Avoid an infinite loop if we've already warned about this
1519 // https://github.com/processing/processing/issues/4805
1520 if (!disappearedWarning) {
1521 disappearedWarning = true;
1522
1523 // Disaster recovery, try to salvage what's there already.
1524 Messages.showWarning(Language.text("ensure_exist.messages.missing_sketch"),
1525 Language.text("ensure_exist.messages.missing_sketch.description"));
1526 try {
1527 folder.mkdirs();
1528 modified = true;
1529
1530 for (int i = 0; i < codeCount; i++) {
1531 code[i].save(); // this will force a save
1532 }
1533 calcModified();
1534
1535 } catch (Exception e) {
1536 // disappearedWarning prevents infinite loop in this scenario
1537 Messages.showWarning(Language.text("ensure_exist.messages.unrecoverable"),
1538 Language.text("ensure_exist.messages.unrecoverable.description"), e);
1539 }
1540 }
1541 }
1542 }
1543
1544
1545 /**

Callers 11

insertCodeMethod · 0.95
handleNewCodeMethod · 0.95
handleRenameCodeMethod · 0.95
nameCodeMethod · 0.95
handleDeleteCodeMethod · 0.95
saveMethod · 0.95
handleAddFileMethod · 0.95
windowGainedFocusMethod · 0.80
prepareRunMethod · 0.80
handleImportLibraryMethod · 0.80
preprocessMethod · 0.80

Calls 4

showWarningMethod · 0.95
textMethod · 0.95
calcModifiedMethod · 0.95
saveMethod · 0.45

Tested by

no test coverage detected