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

sanitize uppercase filenames used in headers when adding new files to the project #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

buzzdeee
Copy link
Contributor

For #define something in C, only alphanumeric and _ are allowed.

When creating a new file in the project, esp. headers, some ifdef dance is added, to prevent double inclusion. This take the file name literally.

For Categories, it's common to use NSSomeClass+Category as name, and that + sign breaks build.

Therefore sanitize the generated uppercase header file name, replace any non alphanumeric and _ with _ before replacing the string in the template.

When creating a new file in the project, esp. headers, some ifdef dance is added,
to prevent double inclusion. This take the file name literally.

For Categories, it's common to use NSSomeClass+Category as name,
and that + sign breaks build.

Therefore sanitize the generated uppercase header file name, replace
any non alphanumeric and _ with _ before replacing the string in
the template.
@buzzdeee buzzdeee requested a review from gcasa as a code owner August 30, 2024 21:21
if ([allowedCharacters characterIsMember:character])
{
[sanitizedString appendFormat:@"%C", character];
} else {
Copy link
Member

Choose a reason for hiding this comment

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

This else should be on separate lines... like so...

}
else
{

Other than that looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants