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,13 +652,12 @@ public class Sketch {
|
||||
// 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
|
||||
// resaved (with the same name) to another location/folder.
|
||||
for (SketchCode code : data.getCodes()) {
|
||||
if (newName.equalsIgnoreCase(code.getPrettyName()) && code.isExtension("cpp")) {
|
||||
for (int i = 0; i < data.getCodeCount(); i++) {
|
||||
SketchCode code = data.getCode(i);
|
||||
if (newName.equalsIgnoreCase(code.getPrettyName())) {
|
||||
Base.showMessage(tr("Error"),
|
||||
I18n.format(
|
||||
tr("You can't save the sketch as \"{0}\"\n" +
|
||||
"because the sketch already has a .cpp file with that name."),
|
||||
newName
|
||||
I18n.format(tr("You can't save the sketch as \"{0}\"\n" +
|
||||
"because the sketch already has a file with that name."), newName
|
||||
));
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user