diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 9c6a93c59..d317b4dfe 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -652,14 +652,13 @@ 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; } }