diff --git a/resource/main.cpp b/resource/main.cpp index 4eddb8b..242f9bb 100644 --- a/resource/main.cpp +++ b/resource/main.cpp @@ -1,6 +1,5 @@ #include #include -#include using namespace std; @@ -58,11 +57,16 @@ int main(int argc, char *argv[]) string outFilename(argv[1]); string packName = outFilename.substr(outFilename.find_last_of('/')+1); packName = packName.substr(0, packName.find_first_of('.')); - if(!regex_match(packName, regex("[a-zA-Z0-9]+"))) - { - printf("error : \"%s\" is an invalid resource pack name, it must match this regex : [a-zA-Z0-9]+\n", packName.c_str()); - return EXIT_SUCCESS; - } + for(char c : packName) + { + if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9') + ; // OK + else + { + printf("error : \"%s\" is an invalid resource pack name, it must match this regex : [a-zA-Z0-9]+\n", packName.c_str()); + return EXIT_SUCCESS; + } + } FILE *out = fopen(outFilename.c_str(), "w"); if(out == NULL) {