Skip to content

Sketch tab rename consisting only of case changes prevented on case-insensitive file systems #2272

Open
@per1234

Description

@per1234

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

  1. Use Arduino IDE on a macOS or Windows machine.
  2. Click the ●●● icon on the editor toolbar.
    The editor toolbar context menu will open.
  3. Select "New Tab" from the menu.
    The "Name for new file" dialog will open.
  4. Type foo in the tab name field in the dialog.
  5. Click the "OK" button.
    A new editor tab named "foo.ino" is added in Arduino IDE.

Demo

  1. Click the ●●● icon on the editor toolbar.
    The editor toolbar context menu will open.
  2. Select "Rename" from the menu.
    The "New name for file" dialog will open.
  3. 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

69b7365

Operating system

  • Windows
  • macOS

Operating system version

  • Windows 11
  • macOS Ventura

Additional context

Originally reported at

Workaround

  1. 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:

  1. 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:
    image
  2. 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

Metadata

Metadata

Assignees

No one assigned

    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