Allow leading underscore in sketch filenames (#2105)
The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames. The origin of the specification is the text of the error message shown in Arduino IDE when the user attempts to save to a name that contains disallowed characters: https://github.com/arduino/Arduino/blob/89539b1131f8cde9f7a83225f21c811071af53a8/app/src/processing/app/SketchController.java#L847-L853 However, the implementation of the restriction in the IDE codebase has a bug that allows a leading underscore (because the code uses _ as the replacement character). After the restriction was implemented correctly in Arduino IDE 2.x, it was discovered that the loss of compatibility with these non-compliant names was impactful. One of the primary purposes for the specification and restrictions is to ensure sketches can be used in any tool. Since the tools support this name format and there is no technical reason to disallow it, the best thing to do is change the sketch specification to follow the historic tool behavior (even if that behavior was the result of a benign bug). Leading underscores in sketch folder names and sketch code filenames are hereby permitted by the Arduino Sketch Specification and `arduino-cli sketch new`.
Showing
Please register or sign in to comment