Skip to content

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

Open
buzzdeee wants to merge 2 commits into
gnustep:masterfrom
buzzdeee:sanitize_define_names_on_file_create
Open

sanitize uppercase filenames used in headers when adding new files to the project#36
buzzdeee wants to merge 2 commits into
gnustep:masterfrom
buzzdeee:sanitize_define_names_on_file_create

Conversation

@buzzdeee

Copy link
Copy Markdown
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
Comment thread Framework/PCFileCreator.m Outdated
if ([allowedCharacters characterIsMember:character])
{
[sanitizedString appendFormat:@"%C", character];
} else {

Copy link
Copy Markdown
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
Copy Markdown
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