Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
KurtE opened this issue Jun 24, 2022 · 0 comments
Open
3 tasks done
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@KurtE
Copy link

KurtE commented Jun 24, 2022

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
@KurtE KurtE added the type: imperfection Perceived defect in any part of project label Jun 24, 2022
@per1234 per1234 added the topic: code Related to content of the project itself label Jun 24, 2022
@per1234 per1234 changed the title Open old library example(.pde file) do Save As to your Sketch folder with different name and sketch name wrong Primary sketch filename not updated on "Save As" operation when it has a .pde extension Jun 10, 2023
@per1234 per1234 changed the title Primary sketch filename not updated on "Save As" operation when it has a .pde extension Primary sketch filename not updated when sketch is renamed when it has a .pde extension Jun 10, 2023
@per1234 per1234 changed the title Primary sketch filename not updated when sketch is renamed when it has a .pde extension Primary sketch filename not updated on sketch rename when it has a .pde extension Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants