Save all code in the current sketch. This just forces the files to save in place, so if it's an untitled (un-saved) sketch, saveAs() should be called instead. (This is handled inside Editor.handleSave()).
()
| 795 | * called instead. (This is handled inside Editor.handleSave()). |
| 796 | */ |
| 797 | public boolean save() throws IOException { |
| 798 | // make sure the user didn't hide the sketch folder |
| 799 | ensureExistence(); |
| 800 | |
| 801 | // first get the contents of the editor text area |
| 802 | updateSketchCodes(); |
| 803 | |
| 804 | // don't do anything if not actually modified |
| 805 | //if (!modified) return false; |
| 806 | |
| 807 | if (isReadOnly()) { |
| 808 | // if the files are read-only, need to first do a "save as". |
| 809 | Messages.showMessage(Language.text("save_file.messages.is_read_only"), |
| 810 | Language.text("save_file.messages.is_read_only.description")); |
| 811 | // if the user cancels, give up on the save() |
| 812 | if (!saveAs()) return false; |
| 813 | } |
| 814 | |
| 815 | for (SketchCode sc : code) { |
| 816 | if (sc.isModified()) { |
| 817 | sc.save(); |
| 818 | } |
| 819 | } |
| 820 | calcModified(); |
| 821 | return true; |
| 822 | } |
| 823 | |
| 824 | |
| 825 | /** |
no test coverage detected