Set LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to empty if not set at all

Work around qt being stupid.

Task-number: QTCREATORBUG-6583
Change-Id: I9443adea0b2be7e4d26d70ab817858d71fa1bbdb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Daniel Teske
2011-11-23 15:21:07 +01:00
parent f709f4b071
commit fd19e94e35

View File

@@ -657,6 +657,19 @@ void QtcProcess::start()
if (m_environment.size() == 0)
qWarning("QtcProcess::start: Empty environment set when running '%s'.", qPrintable(m_command));
env = m_environment;
// If the process environemnt has no libraryPath,
// Qt will copy creator's libraryPath into the process environment.
// That's brain dead, and we work around it
#if defined(Q_OS_UNIX)
# if defined(Q_OS_MAC)
static const char libraryPath[] = "DYLD_LIBRARY_PATH";
# else
static const char libraryPath[] = "LD_LIBRARY_PATH";
# endif
if (env.constFind(libraryPath) == env.constEnd())
env.set(libraryPath, QLatin1String(""));
#endif
QProcess::setEnvironment(env.toStringList());
} else {
env = Environment::systemEnvironment();