mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
SaveAs should preserve the folder structure if user selected a sketch
Fixes https://github.com/arduino/Arduino/issues/6416
This commit is contained in:
parent
7bef3d549b
commit
2be54da740
@ -387,7 +387,14 @@ public class SketchController {
|
||||
if (newName == null) return false;
|
||||
newName = SketchController.checkName(newName);
|
||||
|
||||
File newFolder = new File(newParentDir, newName);
|
||||
File newFolder;
|
||||
// User may want to overwrite a .ino
|
||||
// check if the parent folder name ends with the sketch name
|
||||
if (newName.endsWith(".ino") && newParentDir.endsWith(newName.substring(0, newName.lastIndexOf('.'))+ File.separator)) {
|
||||
newFolder = new File(newParentDir);
|
||||
} else {
|
||||
newFolder = new File(newParentDir, newName);
|
||||
}
|
||||
|
||||
// check if the paths are identical
|
||||
if (newFolder.equals(sketch.getFolder())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user