We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bdcba7 commit f7adc39Copy full SHA for f7adc39
app/src/processing/app/SketchController.java
@@ -387,7 +387,14 @@ protected boolean saveAs() throws IOException {
387
if (newName == null) return false;
388
newName = SketchController.checkName(newName);
389
390
- File newFolder = new File(newParentDir, newName);
+ File newFolder;
391
+ // User may want to overwrite a .ino
392
+ // check if the parent folder name ends with the sketch name
393
+ if (newName.endsWith(".ino") && newParentDir.endsWith(newName.substring(0, newName.lastIndexOf('.'))+ File.separator)) {
394
+ newFolder = new File(newParentDir);
395
+ } else {
396
+ newFolder = new File(newParentDir, newName);
397
+ }
398
399
// check if the paths are identical
400
if (newFolder.equals(sketch.getFolder())) {
0 commit comments