Skip to content

Primary sketch filename not updated on sketch rename when it has a .pde extension #1111

Open
@KurtE

Description

@KurtE

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

  1. Click the following link to download the demonstration sketch:
    HasPdeExtension.zip
  2. Unzip the downloaded file.
  3. Select File > Open from the Arduino IDE menus.
  4. Select the unzipped HasPdeExtension sketch folder.
  5. Click the "Open" button.
  6. A notification appears:

    The 'HasPdeExtension' still uses the old .pde format. Do you want to switch to the new .ino extension?

  7. Click the "YES" button on the notification.
    A "Save As" dialog will open.
  8. 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.
  9. 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:
    HasPdeExtensionMigrate/
    └── HasPdeExtension.pde
    
    (note HasPdeExtensionMigrate vs. HasPdeExtension)
  10. Switch back to the Arduino IDE window that has the HasPdeExtension sketch open.
  11. Select File > Save As... from the Arduino IDE menus.
  12. 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.
  13. 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:
    HasPdeExtensionSaveAs/
    └── HasPdeExtension.pde
    
    (note HasPdeExtensionSaveAs vs. HasPdeExtension)
  14. Switch back to the Arduino IDE window that has the HasPdeExtension sketch open.
  15. Click the ●●● icon on the right side of the Arduino IDE editor toolbar.
  16. Select "Rename" from the menu.
  17. 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.
  18. 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:
    HasPdeExtensionRename/
    └── HasPdeExtension.pde
    
    (note 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

db0049d

Operating system

Windows, Linux

Operating system version

  • Windows 10
  • Windows 11
  • Ubuntu 22.04

Additional context

Additional reports

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

Metadata

Metadata

Assignees

Labels

topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions