Do not break systems with cr as line endings
This commit is contained in:
parent
ad45bf1d61
commit
cc8a34cd14
@ -89,6 +89,20 @@ struct NoneOf
|
||||
const char* _str;
|
||||
};
|
||||
|
||||
// Replaces all occurrences of "from" with the contents of "to"
|
||||
// It does only one pass, i.e. new matches created in a position before the current match are not replaced
|
||||
std::string replaceAll(const std::string& str, const std::string& from, const std::string& to)
|
||||
{
|
||||
std::string result = str;
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = result.find(from, pos)) != std::string::npos)
|
||||
{
|
||||
result.replace(pos, from.length(), to);
|
||||
pos += to.length();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using namespace osg;
|
||||
@ -642,6 +656,8 @@ void Shader::PerContextShader::compileShader(osg::State& state)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert all windows line endings to \n
|
||||
source = replaceAll(source, "\r\n", "\n");
|
||||
|
||||
std::string versionLine;
|
||||
unsigned int lineNum = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user