diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 1c2ab89b9..ed09492b6 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -648,13 +648,8 @@ public class Sketch { } else { // default to the parent folder of where this was // on macs a .getParentFile() method is required - - if (OSUtils.isMacOS()) { - fd.setSelectedFile(data.getFolder().getParentFile()); - } else { - fd.setSelectedFile(data.getFolder()); - } - + + fd.setDirectory(data.getFolder().getParentFile().getAbsolutePath()); } String oldName = data.getName(); fd.setFile(oldName); @@ -673,14 +668,13 @@ public class Sketch { // but ignore this situation for the first tab, since it's probably being // resaved (with the same name) to another location/folder. for (SketchCode code : data.getCodes()) { - if (newName.equalsIgnoreCase(code.getPrettyName()) && - code.isExtension("cpp")) { + if (newName.equalsIgnoreCase(code.getPrettyName()) && code.isExtension("cpp")) { Base.showMessage(_("Nope"), - I18n.format( - _("You can't save the sketch as \"{0}\"\n" + - "because the sketch already has a .cpp file with that name."), - newName - )); + I18n.format( + _("You can't save the sketch as \"{0}\"\n" + + "because the sketch already has a .cpp file with that name."), + newName + )); return false; } } @@ -699,11 +693,12 @@ public class Sketch { if (newPath.indexOf(oldPath) == 0) { Base.showWarning(_("How very Borges of you"), - _("You cannot save the sketch into a folder\n" + - "inside itself. This would go on forever."), null); + _("You cannot save the sketch into a folder\n" + + "inside itself. This would go on forever."), null); return false; } - } catch (IOException e) { } + } catch (IOException e) { + } // if the new folder already exists, then need to remove // its contents before copying everything over @@ -755,10 +750,10 @@ public class Sketch { data.getCode(0).saveAs(newFile); editor.handleOpenUnchecked(newFile, - currentIndex, - editor.getSelectionStart(), - editor.getSelectionStop(), - editor.getScrollPosition()); + currentIndex, + editor.getSelectionStart(), + editor.getSelectionStop(), + editor.getScrollPosition()); // Name changed, rebuild the sketch menus //editor.sketchbook.rebuildMenusAsync();