Closed
Description
Describe the problem
Arduino sketches may contain files under subfolders:
🐛 After a "Save As..." operation, any subfolders are lost and the files are all moved to the root sketch folder.
To reproduce
- Click the following link to download the demonstration sketch:
HasSubfolders.zip - Unzip the downloaded file.
- Take note of the file structure of the sketch:
HasSubfolders/ ├── HasSubfolders.ino └── src/ └── FromSubfolder.h
- Select File > Open from the Arduino IDE menus.
- Select the
HasSubfolders.ino
file from the unzipped folder. - Select File > Save As..." from the Arduino IDE menus.
- Save the sketch to any convenient name and location.
- Select Sketch > Show Sketch Folder from the Arduino IDE menus.
🐛 The subfolder structure of the sketch was lost:
HasSubfoldersAfterSaveAs/
├── FromSubfolder.h
└── HasSubfoldersAfterSaveAs.ino
Expected behavior
A "Save As" operation does not make any changes to the sketch file structure.
Arduino IDE version
Operating system
- Windows
- Linux
- macOS
Operating system version
- Windows 11
- Ubuntu 22.04
- macOS Ventura
Additional context
I bisected the regression to 0ab2826 (the fault does not occur when using 2aad0e3).
Additional reports
- Subfolder structure of sketch lost after "Save As" operation #2077 (comment)
- https://forum.arduino.cc/t/ide-2-2-1-save-as-does-not-copy-subfolders-correctly/1191437
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details