theos / nic

Generates Theos projects based on a template.
Other
11 stars 5 forks source link

Strip invalid chars from proj name and use that string where applicable #16

Closed L1ghtmann closed 2 years ago

L1ghtmann commented 2 years ago

What does this implement/fix? Explain your changes.

The NIC will now strip characters that are not alphanum or "+", "-", "." from the project name provided by the user and use that name where necessary (i.e., as the project directory name, as the Package: field of the control file, and as the *_NAME field in the Makefile).

Does this close any currently open issues?

Resolves #3

Any relevant logs, error output, etc?

N/A

Any other comments?

For a project named: "this 1_-- is a.!/ ,test+"

The NIC made:

include $(THEOS)/makefiles/common.mk

TOOL_NAME = this1--isa.,test+

this1--isa.,test+_FILES = main.m this1--isa.,test+_CFLAGS = -fobjc-arc this1--isa.,test+_CODESIGN_FLAGS = -Sentitlements.plist this1--isa.,test+_INSTALL_PATH = /usr/local/bin

include $(THEOS_MAKE_PATH)/tool.mk


which compiled successfully:

Making all for tool this1--isa.,test+… ==> Compiling main.m (armv7)… ==> Compiling main.m (arm64e)… ==> Compiling main.m (arm64)… ==> Linking tool this1--isa.,test+ (arm64)… ==> Generating debug symbols for this1--isa.,test+… ==> Linking tool this1--isa.,test+ (arm64e)… ==> Generating debug symbols for this1--isa.,test+… ==> Linking tool this1--isa.,test+ (armv7)… ==> Generating debug symbols for this1--isa.,test+… ==> Merging tool this1--isa.,test+… ==> Signing this1--isa.,test+… Making stage for tool this1--isa.,test+… dm.pl: building package com.yourcompany.this1--isa.,test+:iphoneos-arm' in./packages/com.yourcompany.this1--isa.,test+_0.0.1-1+debug_iphoneos-arm.deb'

Note: I got the alphanum + "+-." from dm.pl. If there is a different regex you guys want to use, just let me know and I can change what's removed here.

Where has this been tested?

Operating System:

Linux (WSL)

Platform:

Target Platform:

Toolchain Version:

SDK Version:

uroboro commented 2 years ago

Note: I got the alphanum + "+-." from dm.pl. If there is a different regex you guys want to use, just let me know and I can change what's removed here.

I think it's good that both are in sync.

I noticed that the comma is not being stripped, is this because the output is from a previous run with a different regex?

L1ghtmann commented 2 years ago

Huh, didn't catch that before. Nope, that's with the current regex. Just ran it again to confirm. Seems that allowing "." also allows "," for some reason. Doesn't seem to cause any issues though. Worth trying to exclude it?

kirb commented 2 years ago

It’s because of +-. - it’s expanding to every character between the two in ASCII, +,-.. Putting - at the end of the list would fix it.

L1ghtmann commented 2 years ago

Well today I learned, thanks! Should that also be adjusted in dm.pl's regex?

kirb commented 2 years ago

Ah good point, yep indeed that should be fixed.