From 2d367e757dbfc7f8b129d70241920f340ea7067b Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 17 Dec 2015 17:18:41 +0100 Subject: [PATCH] Allow .cpp files named after the primary .ino file This limitation was added a long time ago, when the build system did not cope with this. The current build system handles this situation just fine, so this limitation can be lifted. --- app/src/processing/app/SketchController.java | 35 -------------------- 1 file changed, 35 deletions(-) diff --git a/app/src/processing/app/SketchController.java b/app/src/processing/app/SketchController.java index d539fb336..43de0d137 100644 --- a/app/src/processing/app/SketchController.java +++ b/app/src/processing/app/SketchController.java @@ -208,28 +208,6 @@ public class SketchController { } } - // In Arduino, don't allow a .cpp file with the same name as the sketch, - // because the sketch is concatenated into a file with that name as part - // of the build process. - if (newName.equals(sketch.getName() + ".cpp")) { - Base.showMessage(tr("Error"), - tr("You can't have a .cpp file with the same name as the sketch.")); - return; - } - - if (renamingCode && current.isPrimary()) { - for (SketchFile file : sketch.getFiles()) { - if (sanitaryName.equalsIgnoreCase(file.getBaseName()) && - file.isExtension("cpp")) { - Base.showMessage(tr("Error"), - I18n.format(tr("You can't rename the sketch to \"{0}\"\n" - + "because the sketch already has a .cpp file with that name."), - sanitaryName)); - return; - } - } - } - File newFile = new File(sketch.getFolder(), newName); // if (newFile.exists()) { // yay! users will try anything @@ -560,19 +538,6 @@ public class SketchController { File newFolder = new File(newParentDir, newName); - // 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 (SketchFile file : sketch.getFiles()) { - if (!file.isPrimary() && newName.equalsIgnoreCase(file.getBaseName())) { - Base.showMessage(tr("Error"), - 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; - } - } - // check if the paths are identical if (newFolder.equals(sketch.getFolder())) { // just use "save" here instead, because the user will have received a