File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -132,11 +132,18 @@ public boolean test(SketchController controller) {
132132 }
133133 }
134134
135- private static class ShouldSaveReadOnly implements Predicate <SketchController > {
135+ private static class CanExportInSketchFolder
136+ implements Predicate <SketchController > {
136137
137138 @ Override
138- public boolean test (SketchController sketch ) {
139- return sketch .isReadOnly ();
139+ public boolean test (SketchController controller ) {
140+ if (controller .isReadOnly ()) {
141+ return false ;
142+ }
143+ if (controller .getSketch ().isModified ()) {
144+ return PreferencesData .getBoolean ("editor.save_on_verify" );
145+ }
146+ return true ;
140147 }
141148 }
142149
@@ -665,11 +672,12 @@ private void buildSketchMenu(JMenu sketchMenu) {
665672
666673 item = newJMenuItemAlt (tr ("Export compiled Binary" ), 'S' );
667674 item .addActionListener (event -> {
668- if (new ShouldSaveReadOnly ().test (sketchController ) && ! handleSave ( true )) {
675+ if (!( new CanExportInSketchFolder ().test (sketchController ))) {
669676 System .out .println (tr ("Export canceled, changes must first be saved." ));
670677 return ;
671678 }
672- handleRun (false , new ShouldSaveReadOnly (), presentAndSaveHandler , runAndSaveHandler );
679+ handleRun (false , new CanExportInSketchFolder (), presentAndSaveHandler , runAndSaveHandler );
680+
673681 });
674682 sketchMenu .add (item );
675683
You can’t perform that action at this time.
0 commit comments