Description
Sketch tab rename consisting only of case changes prevented on case-insensitive file systems
Describe the problem
Windows and macOS (by default) use a case insensitive file system, where from a user perspective there is no functional difference between a file named foo
and Foo
. However, filename case has a semantic significance and these file systems are "case-preserving", meaning the user has control over case in file names.
The files of a sketch are represented by editor tabs in Arduino IDE. The files can be renamed by selecting "Rename" from the editor toolbar context menu.
Arduino IDE's "Rename" feature prohibits a rename operation under the following conditions:
- The new name differs only in case from the previous name
- The file system is case insensitive (or perhaps just macOS/Windows)
🐛 The user is forced to either resign themselves to a semantically sub-ideal filename or else use an alternative method for renaming the file, which will be inconvenient and might cause other problems.
To reproduce
Set Up
- Use Arduino IDE on a macOS or Windows machine.
- Click the ●●● icon on the editor toolbar.
The editor toolbar context menu will open. - Select "New Tab" from the menu.
The "Name for new file" dialog will open. - Type
foo
in the tab name field in the dialog. - Click the "OK" button.
A new editor tab named "foo.ino" is added in Arduino IDE.
Demo
- Click the ●●● icon on the editor toolbar.
The editor toolbar context menu will open. - Select "Rename" from the menu.
The "New name for file" dialog will open. - Type
Foo
in the tab name field in the dialog.
🐛 An incorrect message is shown in the dialog:
'Foo.ino' already exists.
🐛 The "OK" button in the dialog is disabled.
Expected behavior
It is possible to change the case of sketch filenames via the Arduino IDE tab rename feature on all case-preserving file systems.
Arduino IDE version
Operating system
- Windows
- macOS
Operating system version
- Windows 11
- macOS Ventura
Additional context
Originally reported at
Workaround
- Use your file manager or terminal to rename the sketch file.
You will now see that the renamed tab has been duplicated in Arduino IDE (#482). You can restore the IDE from this broken state by performing the following procedure:
- Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
A menu will appear on the editor toolbar:
- Select the "View: Reset Workbench Layout" command from the menu.
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