optimize filePrefixRoot()

more efficient use of string functions.

Change-Id: I3d95d6379eaab025b18449b706f93631a2132aad
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2014-11-13 18:02:02 +01:00
parent eb9db750e9
commit 2b31356ac9

View File

@ -1190,11 +1190,13 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src)
QString
MakefileGenerator::filePrefixRoot(const QString &root, const QString &path)
{
QString ret(root + path);
QString ret(path);
if(path.length() > 2 && path[1] == ':') //c:\foo
ret = QString(path.mid(0, 2) + root + path.mid(2));
while(ret.endsWith("\\"))
ret = ret.left(ret.length()-1);
ret.insert(2, root);
else
ret.prepend(root);
while (ret.endsWith('\\'))
ret.chop(1);
return ret;
}