Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow leading underscore in sketch filenames #1955

Merged
merged 1 commit into from
Mar 13, 2023

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Mar 13, 2023

Motivation

The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames. Arduino IDE enforces compliance with the specification in order to ensure sketches created with Arduino IDE can be used with any other Arduino development tool.

The Arduino Sketch Specification is being changed to allow a leading underscore in sketch folder names and sketch code filenames:

arduino/arduino-cli#2105

Change description

Update Arduino IDE's sketch name validation according to the specification change.

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 13, 2023
@per1234 per1234 requested a review from kittaakos March 13, 2023 04:48
@per1234 per1234 self-assigned this Mar 13, 2023
@kittaakos
Copy link
Contributor

Before relaxing the sketch folder and filename validation in this PR, IDE2 used 0 as the default first character (defaultFallbackFirstChar). See here:

export const defaultFallbackFirstChar = '0';

Can IDE2 drop 0 as the default first char and use an underscore (_) instead? What do you think?

@per1234
Copy link
Contributor Author

per1234 commented Mar 13, 2023

use an underscore (_) instead? What do you think?

It's fine by me. That is actually what Arduino IDE 1.x does when you try to save a sketch with an invalid first character (it uses _ as the replacement character regardless of position).

Shall I update the PR accordingly?

@kittaakos
Copy link
Contributor

It's fine by me.

Shall I update the PR accordingly?

If you agree with this change, doing it in this PR would be great. Thanks!

The Arduino Sketch Specification defines the allowed format of sketch folder names and sketch code filenames. Arduino
IDE enforces compliance with the specification in order to ensure sketches created with Arduino IDE can be used with any
other Arduino development tool.

The Arduino Sketch Specification has been changed to allow a leading underscore in sketch folder names and sketch code
filenames so IDE's sketch name validation must be updated accordingly.
@per1234 per1234 force-pushed the allow_sketch_leading_underscore branch from 828bd87 to a8ec75d Compare March 13, 2023 08:51
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. Thank you for taking care of it.

@per1234 per1234 merged commit 58aac23 into arduino:main Mar 13, 2023
@per1234 per1234 deleted the allow_sketch_leading_underscore branch April 1, 2023 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants