Description
Describe the problem
An Arduino sketch is a folder. It is mandatory for the filename of the primary sketch file to match the sketch folder name. For this reason, the IDE must update the filename of the primary sketch file whenever an operation changes the sketch folder name:
- Save As
- Rename
The original file extension for Arduino language files in Arduino sketches was .pde
. Support was later added for the .ino
file extension, but .pde
is still supported (though recently deprecated).
🐛 If the primary sketch file has a .pde
file extension, the file is not renamed along with the sketch folder. This results in an invalid sketch.
To reproduce
- Click the following link to download the demonstration sketch:
HasPdeExtension.zip - Unzip the downloaded file.
- Select File > Open from the Arduino IDE menus.
- Select the unzipped
HasPdeExtension
sketch folder. - Click the "Open" button.
- A notification appears:
The 'HasPdeExtension' still uses the old .pde format. Do you want to switch to the new .ino extension?
- Click the "YES" button on the notification.
A "Save As" dialog will open. - Save the sketch to a convenient location with the name HasPdeExtensionMigrate
🐛 The original HasPdeExtension sketch remains open in the Arduino IDE window instead of the expected result of the HasPdeExtensionMigrate sketch opening. - Use your file browser or terminal to examine the contents of the folder where you saved the HasPdeExtensionMigrate sketch.
🐛 The primary sketch file was not renamed to match the sketch name.
🐛 The primary sketch file was not renamed to use the.ino
file extension as promised by the notification:(noteHasPdeExtensionMigrate/ └── HasPdeExtension.pde
HasPdeExtensionMigrate
vs.HasPdeExtension
) - Switch back to the Arduino IDE window that has the HasPdeExtension sketch open.
- Select File > Save As... from the Arduino IDE menus.
- Save the sketch to a convenient location with the name HasPdeExtensionSaveAs
🐛 The original HasPdeExtension sketch remains open in the Arduino IDE window instead of the expected result of the HasPdeExtensionSaveAs sketch opening. - Use your file browser or terminal to examine the contents of the folder where you saved the HasPdeExtensionSaveAs sketch.
🐛 The primary sketch file was not renamed to match the sketch name:(noteHasPdeExtensionSaveAs/ └── HasPdeExtension.pde
HasPdeExtensionSaveAs
vs.HasPdeExtension
) - Switch back to the Arduino IDE window that has the HasPdeExtension sketch open.
- Click the ●●● icon on the right side of the Arduino IDE editor toolbar.
- Select "Rename" from the menu.
- Save the sketch to a convenient location with the name HasPdeExtensionRename
🐛 The original HasPdeExtension sketch remains open in the Arduino IDE window instead of the expected result of the HasPdeExtensionRename sketch opening. - Use your file browser or terminal to examine the contents of the folder where you saved the HasPdeExtensionRename sketch.
🐛 The primary sketch file was not renamed to match the sketch name:(noteHasPdeExtensionRename/ └── HasPdeExtension.pde
HasPdeExtensionRename
vs.HasPdeExtension
)
Expected behavior
The primary sketch file is always renamed when an operation performed by Arduino IDE changes the sketch folder name.
Arduino IDE version
Original report
2.0.0-rc8
Last verified with
Operating system
Windows, Linux
Operating system version
- Windows 10
- Windows 11
- Ubuntu 22.04
Additional context
Additional reports
- https://forum.arduino.cc/t/ide-2-1-wont-open-my-old-sketches/1136392/4
- https://forum.arduino.cc/t/new-file-extension-in-arduino-ide-2-2-1/1220558
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