Summary: | QMake manager, error parsing .pro when using 'include' function and an environment variable | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Rui L. Pires <rlpires> |
Component: | general | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 3.4.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Rui L. Pires
2007-04-11 10:54:18 UTC
SVN commit 652641 by apaku: Substitute shell variables with real values. Note: The shell variables need to be set when starting KDevelop Also fix a small bug along the way wrt. opening include( foobar.pri ). BUG:144063 M +18 -1 scope.cpp --- branches/KDE/3.5/kdevelop/buildtools/qmake/scope.cpp #652640:652641 @@ -883,7 +883,7 @@ { QMake::IncludeAST * i = static_cast<QMake::IncludeAST*>( *it ); QString filename = i->projectName; - if( i->projectName.startsWith("$") ) + if( i->projectName.stripWhiteSpace().startsWith("$") ) { filename = resolveVariables(i->projectName, *it); } @@ -1250,6 +1250,23 @@ pos += re.matchedLength(); } } + re = QRegExp("\\$\\$\\(([^\\)\\}]*)\\)"); + pos = 0; + QMap<QString, QString> envvars; + while( pos >= 0 ) + { + pos = re.search( (*it), pos ); + if( pos > -1 ) + { + if( !envvars.contains( re.cap(1) ) && ::getenv( re.cap(1).local8Bit() ) != 0 ) + envvars[re.cap(1)] = QString::fromLocal8Bit(::getenv( re.cap(1).local8Bit() ) ); + pos += re.matchedLength(); + } + } + for( QMap<QString, QString>::const_iterator it2 = envvars.begin(); it2 != envvars.end(); ++it2 ) + { + (*it).replace("$$("+it2.key()+")", it2.data() ); + } for( QMap<QString, QStringList>::const_iterator it2 = variables.begin(); it2 != variables.end(); ++it2 ) { for( QStringList::const_iterator it3 = it2.data().begin(); it3 != it2.data().end(); ++it3 ) |