From d9d5a648f6f46e32ee0e80848824196b22fe2f1d Mon Sep 17 00:00:00 2001 From: Anselme Date: Tue, 31 May 2016 23:37:52 +0200 Subject: [PATCH] removed usage of std::regex for compatibility with older versions of gcc --- resource/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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) {