mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Fail to save sketch if user attempts to save it with the same name of one of its tabs, excluding the first. Fixes #3914
This commit is contained in:
parent
651ae04a19
commit
9af0eee338
@ -652,14 +652,13 @@ public class Sketch {
|
|||||||
// make sure there doesn't exist a .cpp file with that name already
|
// make sure there doesn't exist a .cpp file with that name already
|
||||||
// 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 (int i = 0; i < data.getCodeCount(); i++) {
|
||||||
if (newName.equalsIgnoreCase(code.getPrettyName()) && code.isExtension("cpp")) {
|
SketchCode code = data.getCode(i);
|
||||||
|
if (newName.equalsIgnoreCase(code.getPrettyName())) {
|
||||||
Base.showMessage(tr("Error"),
|
Base.showMessage(tr("Error"),
|
||||||
I18n.format(
|
I18n.format(tr("You can't save the sketch as \"{0}\"\n" +
|
||||||
tr("You can't save the sketch as \"{0}\"\n" +
|
"because the sketch already has a file with that name."), newName
|
||||||
"because the sketch already has a .cpp file with that name."),
|
));
|
||||||
newName
|
|
||||||
));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user