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.
()
| 1605 | * main folder is still around, but not its contents. |
| 1606 | */ |
| 1607 | public void ensureExistence() { |
| 1608 | if (!folder.exists()) { |
| 1609 | // Avoid an infinite loop if we've already warned about this |
| 1610 | // https://github.com/processing/processing/issues/4805 |
| 1611 | if (!disappearedWarning) { |
| 1612 | disappearedWarning = true; |
| 1613 | |
| 1614 | // Disaster recovery, try to salvage what's there already. |
| 1615 | Messages.showWarning(Language.text("ensure_exist.messages.missing_sketch"), |
| 1616 | Language.text("ensure_exist.messages.missing_sketch.description")); |
| 1617 | try { |
| 1618 | folder.mkdirs(); |
| 1619 | modified = true; |
| 1620 | |
| 1621 | for (int i = 0; i < codeCount; i++) { |
| 1622 | code[i].save(); // this will force a save |
| 1623 | } |
| 1624 | calcModified(); |
| 1625 | |
| 1626 | } catch (Exception e) { |
| 1627 | // disappearedWarning prevents infinite loop in this scenario |
| 1628 | Messages.showWarning(Language.text("ensure_exist.messages.unrecoverable"), |
| 1629 | Language.text("ensure_exist.messages.unrecoverable.description"), e); |
| 1630 | } |
| 1631 | } |
| 1632 | } |
| 1633 | } |
| 1634 | |
| 1635 | |
| 1636 | /** |
no test coverage detected