Stopping you from renaming the main / first sketch file (.pde) if it contains a .cpp file with the new name.

This commit is contained in:
David A. Mellis 2010-01-28 21:19:53 +00:00
parent a59900692a
commit a5b9d31134
1 changed files with 13 additions and 0 deletions

View File

@ -408,6 +408,19 @@ public class Sketch {
return;
}
if (currentIndex == 0) {
for (int i = 1; i < codeCount; i++) {
if (sanitaryName.equalsIgnoreCase(code[i].getPrettyName()) &&
code[i].getExtension().equalsIgnoreCase("cpp")) {
Base.showMessage("Nope",
"You can't rename the sketch to \"" + sanitaryName + "\"\n" +
"because the sketch already has a .cpp file with that name.");
return;
}
}
}
File newFile = new File(folder, newName);
// if (newFile.exists()) { // yay! users will try anything
// Base.showMessage("Nope",