pelabs
June 10, 2023, 12:43am
1
Win10 user.
IDE 2.1 won't open my old sketches. Is this because they had spaces in them which were converted to underscores?
This makes no sense. And, definitely is a no-go for me.
I have many many sketches, and I go back to them. For example, we're working on Engineering Summer Camp 2023, and I'm going back to Summer Camp 2022 sketches to adjust them. I'm not gonna copy paste all of this, all of the time.
PS: Arduino Forums should use chatgpt to read my submission and figure out which Category to post it in!
2 Likes
If IDE 1.8.x can open your sketches, why bother with the buggy new version?
6v6gt
June 10, 2023, 4:45am
3
Spaces in the file name ?
Then ensure that the name of the containing folder matches any new name of the file.
What is the file extension: .pde or .ino or something else ?
Yes, there is a problem opening files with spaces in the name.
The IDE offers to correct it, if you accepts it creates a copy with the spaces replaced by underscores only in the folder name, but it does not rename the file.
When you want to open the sketch again offers to change the name and again the same...
Same problem when opening .pde files.
The IDE offers to correct it, creates a copy of the folder but does not change the file extension.
I wasn't able to reproduce this. Please provide detailed instructions I can follow to reproduce the bug and I'll investigate further.
Which version of Arduino IDE are you using?
This bug is tracked by the Arduino IDE developers here:
opened 07:00PM - 24 Jun 22 UTC
topic: code
type: imperfection
### 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](https://arduino.github.io/arduino-cli/dev/sketch-specification/#primary-sketch-file). 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](https://arduino.github.io/arduino-cli/dev/sketch-specification/#additional-code-files) (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](https://github.com/arduino/arduino-ide/files/11711809/HasPdeExtension.zip)
1. Unzip the downloaded file.
1. Select **File > Open** from the Arduino IDE menus.
1. Select the unzipped `HasPdeExtension` sketch folder.
1. Click the "**Open**" button.
1. A notification appears:
> **The 'HasPdeExtension' still uses the old .pde format. Do you want to switch to the new .ino extension?**
1. Click the "**YES**" button on the notification.
A "Save As" dialog will open.
1. 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.
1. 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:
```text
HasPdeExtensionMigrate/
└── HasPdeExtension.pde
```
(note `HasPdeExtensionMigrate` vs. `HasPdeExtension`)
1. Switch back to the Arduino IDE window that has the **HasPdeExtension** sketch open.
1. Select **File > Save As...** from the Arduino IDE menus.
1. 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.
1. 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:
```text
HasPdeExtensionSaveAs/
└── HasPdeExtension.pde
```
(note `HasPdeExtensionSaveAs` vs. `HasPdeExtension`)
1. Switch back to the Arduino IDE window that has the **HasPdeExtension** sketch open.
1. Click the **●●●** icon on the right side of the Arduino IDE editor toolbar.
1. Select "**Rename**" from the menu.
1. 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.
1. 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:
```text
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
- https://forum.arduino.cc/t/ide-2-1-wont-open-my-old-sketches/1136392/4
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://github.com/arduino/arduino-ide#nightly-builds)
- [X] My report contains all necessary details
Version 2.1.0, that's what we're talking about, right?
The steps I followed:
I renamed MySketch folder to My Sketch.
I renamed MySketch.ino to My Sketch.ino.
I opened the IDE,
I opened My Sketch from the File/Sketchs menu.
The warning came out and I accepted the name change.
I closed the IDE.
My_Sketch_copy.... folder was generated but the file inside it is My Sketch.ino with no underscore.
I didn't try saving the sketch to see if that would change the name.
Here is what I tried and what I observed:
Create a sketch under your sketchbook folder with this structure:My Sketch/
└── My Sketch.ino
Select File > Sketchbook > My Sketch from the Arduino IDE menus.
The "Invalid sketch name " dialog opens.
Click the "OK " button in the "Invalid sketch name " dialog.
The "Save sketch folder as... " dialog opens.
Click the "Save " button in the "Save sketch folder as... " dialog.
The saved sketch opens in the Arduino IDE window.
Examine the structure of the saved sketch.
The saved sketch has a structure like this:My_Sketch_copy_20230610151837/
└── My_Sketch_copy_20230610151837.ino
So everything is working as expected for me. Do you get different results if you perform that procedure?
Which operating system are you using?
But I can open my old sketches easily without any problem with that I have also migrated all the libraries too
Yes, as I said, with the exact same steps, it only renamed the folder but not the .ino file.
I use W10 Home with all updates up to date.
@ptillisch Surprisingly I repeated the steps again and folder and sketch were renamed correctly.
I don't understand what happened in the previous tests.
Regards
Thanks for the follow up.
Please do let us know (either here on the forum or by submitting a bug report on the GitHub repository ) if you ever find what are the specific conditions under which the sketch file is not renamed to match the new folder name.
system
Closed
December 9, 2023, 5:53am
12
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.