removed usage of std::regex for compatibility with older versions of gcc
This commit is contained in:
parent
dd5cef21c0
commit
d9d5a648f6
@ -1,6 +1,5 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <regex>
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user