()
| 63 | |
| 64 | |
| 65 | public void run() { |
| 66 | editor = base.getActiveEditor(); |
| 67 | Sketch sketch = editor.getSketch(); |
| 68 | |
| 69 | if (sketch.isModified()) { |
| 70 | Messages.showWarning("Save", "Please save the sketch before archiving."); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | File location = sketch.getFolder(); |
| 75 | String name = location.getName(); |
| 76 | File parent = new File(location.getParent()); |
| 77 | |
| 78 | File newbie = null; |
| 79 | String namely = null; |
| 80 | int index = 0; |
| 81 | do { |
| 82 | // only use the date if the sketch name isn't the default name |
| 83 | useDate = !name.startsWith("sketch_"); |
| 84 | |
| 85 | if (useDate) { |
| 86 | String purty = dateFormat.format(new Date()); |
| 87 | String stamp = purty + ((char) ('a' + index)); |
| 88 | namely = name + "-" + stamp; |
| 89 | newbie = new File(parent, namely + ".zip"); |
| 90 | |
| 91 | } else { |
| 92 | String diggie = numberFormat.format(index + 1); |
| 93 | namely = name + "-" + diggie; |
| 94 | newbie = new File(parent, namely + ".zip"); |
| 95 | } |
| 96 | index++; |
| 97 | } while (newbie.exists()); |
| 98 | |
| 99 | // open up a prompt for where to save this fella |
| 100 | PApplet.selectOutput(Language.text("archive_sketch"), |
| 101 | "fileSelected", newbie, this, editor); |
| 102 | } |
| 103 | |
| 104 | |
| 105 | public void fileSelected(File newbie) { |
nothing calls this directly
no test coverage detected