X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fbuild.cpp;h=d9d4e404531404314a941d492454364f9c6abcb5;hb=d052c83e50a258421e1f51ac99b135b403c18989;hp=6462e382ab66aa3f61ccdadb2cfca67fdcead48d;hpb=2057690056f78aeb91f5d70ce9f917bf6845aa6e;p=xonotic%2Fnetradiant.git diff --git a/radiant/build.cpp b/radiant/build.cpp index 6462e382..d9d4e404 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -76,6 +76,53 @@ void setString( const char* string ){ m_string = string; } void evaluate( StringBuffer& output ){ + #if !(GDEF_OS_WINDOWS) + // strip .[ExecutableType] entirely (including preceding dot) on Mac and Linux + { + StringBuffer output; + StringBuffer variable; + bool found_dot = false; + bool in_variable = false; + for (const char *i = m_string.c_str(); *i != '\0'; ++i) { + if (!found_dot && !in_variable) { + switch (*i) { + case '.': + found_dot = true; + break; + default: + output.push_back(*i); + break; + } + } else if (found_dot && !in_variable) { + switch (*i) { + case '[': + in_variable = true; + break; + default: + found_dot = false; + output.push_back(*i); + break; + } + } else { + switch (*i) { + case ']': + found_dot = false; + in_variable = false; + if ( strncmp("ExecutableType", variable.c_str(), sizeof(variable.c_str())) == 0 ) { + output.push_string(""); + variable.clear(); + } + break; + default: + variable.push_back(*i); + break; + } + } + } + setString(output.c_str()); + } + #endif // !(GDEF_OS_WINDOWS) + StringBuffer variable; bool in_variable = false; for ( const char* i = m_string.c_str(); *i != '\0'; ++i )