mirror of
https://github.com/arduino/Arduino.git
synced 2025-04-09 00:53:47 +02:00
Fix to save as to parent folder is needed by all OSs, not just Mac
This commit is contained in:
parent
803a0eebb4
commit
84acf463ec
@ -649,12 +649,7 @@ public class Sketch {
|
|||||||
// default to the parent folder of where this was
|
// default to the parent folder of where this was
|
||||||
// on macs a .getParentFile() method is required
|
// on macs a .getParentFile() method is required
|
||||||
|
|
||||||
if (OSUtils.isMacOS()) {
|
fd.setDirectory(data.getFolder().getParentFile().getAbsolutePath());
|
||||||
fd.setSelectedFile(data.getFolder().getParentFile());
|
|
||||||
} else {
|
|
||||||
fd.setSelectedFile(data.getFolder());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
String oldName = data.getName();
|
String oldName = data.getName();
|
||||||
fd.setFile(oldName);
|
fd.setFile(oldName);
|
||||||
@ -673,8 +668,7 @@ public class Sketch {
|
|||||||
// but ignore this situation for the first tab, since it's probably being
|
// but ignore this situation for the first tab, since it's probably being
|
||||||
// resaved (with the same name) to another location/folder.
|
// resaved (with the same name) to another location/folder.
|
||||||
for (SketchCode code : data.getCodes()) {
|
for (SketchCode code : data.getCodes()) {
|
||||||
if (newName.equalsIgnoreCase(code.getPrettyName()) &&
|
if (newName.equalsIgnoreCase(code.getPrettyName()) && code.isExtension("cpp")) {
|
||||||
code.isExtension("cpp")) {
|
|
||||||
Base.showMessage(_("Nope"),
|
Base.showMessage(_("Nope"),
|
||||||
I18n.format(
|
I18n.format(
|
||||||
_("You can't save the sketch as \"{0}\"\n" +
|
_("You can't save the sketch as \"{0}\"\n" +
|
||||||
@ -703,7 +697,8 @@ public class Sketch {
|
|||||||
"inside itself. This would go on forever."), null);
|
"inside itself. This would go on forever."), null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (IOException e) { }
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
// if the new folder already exists, then need to remove
|
// if the new folder already exists, then need to remove
|
||||||
// its contents before copying everything over
|
// its contents before copying everything over
|
||||||
|
Loading…
x
Reference in New Issue
Block a user