@@ -648,13 +648,8 @@ protected boolean saveAs() throws IOException {
648
648
} else {
649
649
// default to the parent folder of where this was
650
650
// on macs a .getParentFile() method is required
651
-
652
- if (OSUtils .isMacOS ()) {
653
- fd .setSelectedFile (data .getFolder ().getParentFile ());
654
- } else {
655
- fd .setSelectedFile (data .getFolder ());
656
- }
657
-
651
+
652
+ fd .setDirectory (data .getFolder ().getParentFile ().getAbsolutePath ());
658
653
}
659
654
String oldName = data .getName ();
660
655
fd .setFile (oldName );
@@ -673,14 +668,13 @@ protected boolean saveAs() throws IOException {
673
668
// but ignore this situation for the first tab, since it's probably being
674
669
// resaved (with the same name) to another location/folder.
675
670
for (SketchCode code : data .getCodes ()) {
676
- if (newName .equalsIgnoreCase (code .getPrettyName ()) &&
677
- code .isExtension ("cpp" )) {
671
+ if (newName .equalsIgnoreCase (code .getPrettyName ()) && code .isExtension ("cpp" )) {
678
672
Base .showMessage (_ ("Nope" ),
679
- I18n .format (
680
- _ ("You can't save the sketch as \" {0}\" \n " +
681
- "because the sketch already has a .cpp file with that name." ),
682
- newName
683
- ));
673
+ I18n .format (
674
+ _ ("You can't save the sketch as \" {0}\" \n " +
675
+ "because the sketch already has a .cpp file with that name." ),
676
+ newName
677
+ ));
684
678
return false ;
685
679
}
686
680
}
@@ -699,11 +693,12 @@ protected boolean saveAs() throws IOException {
699
693
700
694
if (newPath .indexOf (oldPath ) == 0 ) {
701
695
Base .showWarning (_ ("How very Borges of you" ),
702
- _ ("You cannot save the sketch into a folder\n " +
703
- "inside itself. This would go on forever." ), null );
696
+ _ ("You cannot save the sketch into a folder\n " +
697
+ "inside itself. This would go on forever." ), null );
704
698
return false ;
705
699
}
706
- } catch (IOException e ) { }
700
+ } catch (IOException e ) {
701
+ }
707
702
708
703
// if the new folder already exists, then need to remove
709
704
// its contents before copying everything over
@@ -755,10 +750,10 @@ protected boolean saveAs() throws IOException {
755
750
data .getCode (0 ).saveAs (newFile );
756
751
757
752
editor .handleOpenUnchecked (newFile ,
758
- currentIndex ,
759
- editor .getSelectionStart (),
760
- editor .getSelectionStop (),
761
- editor .getScrollPosition ());
753
+ currentIndex ,
754
+ editor .getSelectionStart (),
755
+ editor .getSelectionStop (),
756
+ editor .getScrollPosition ());
762
757
763
758
// Name changed, rebuild the sketch menus
764
759
//editor.sketchbook.rebuildMenusAsync();
0 commit comments