Commit 7feb54f
authored
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`.1 parent 71a8576 commit 7feb54f
File tree
3 files changed
+10
-7
lines changed- commands/sketch
- docs
3 files changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
0 commit comments