+ // add missing [ExtraQ3map2Args] if "[RadiantPath]q3map2[ExecutableExt]"
+ {
+ const char pattern[] = "\"[RadiantPath]q3map2[ExecutableExt]\"";
+ const char extra[] = "[ExtraQ3map2Args]";
+ const char *string = m_string.c_str();
+ if ( strstr( string, pattern ) != NULL && strstr( string, extra ) == NULL )
+ {
+ StringBuffer output;
+ for ( const char *i = string; *i != '\0'; i++ )
+ {
+ if ( strncmp( i, pattern, sizeof( pattern ) - 1 ) == 0 )
+ {
+ output.push_string(pattern);
+ output.push_string(" ");
+ output.push_string(extra);
+ // minus 1 because \0, no replacement
+ i += strlen( pattern ) - 1;
+ }
+ else
+ {
+ output.push_back(*i);
+ }
+ }
+ setString(output.c_str());
+ }
+ }
+