1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-02 13:24:12 +01:00

Fix to save as to parent folder is needed by all OSs, not just Mac

This commit is contained in:
Federico Fissore 2015-03-04 12:15:07 +01:00
parent 803a0eebb4
commit 84acf463ec

View File

@ -649,12 +649,7 @@ public class Sketch {
// 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,8 +668,7 @@ 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" +
@ -703,7 +697,8 @@ public class Sketch {
"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