We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fea9bd1 commit 5bd6801Copy full SHA for 5bd6801
app/src/processing/app/SketchController.java
@@ -379,7 +379,14 @@ protected boolean saveAs() throws IOException {
379
if (newName == null) return false;
380
newName = SketchController.checkName(newName);
381
382
- File newFolder = new File(newParentDir, newName);
+ File newFolder;
383
+ // User may want to overwrite a .ino
384
+ // check if the parent folder name ends with the sketch name
385
+ if (newName.endsWith(".ino") && newParentDir.endsWith(newName.substring(0, newName.lastIndexOf('.'))+ File.separator)) {
386
+ newFolder = new File(newParentDir);
387
+ } else {
388
+ newFolder = new File(newParentDir, newName);
389
+ }
390
391
// check if the paths are identical
392
if (newFolder.equals(sketch.getFolder())) {
0 commit comments