MCPcopy Create free account
hub / github.com/KDE/kdevelop / effectiveEnvironment

Method effectiveEnvironment

kdevplatform/outputview/outputexecutejob.cpp:533–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531}
532
533QProcessEnvironment OutputExecuteJobPrivate::effectiveEnvironment(const QUrl& workingDirectory) const
534{
535 const EnvironmentProfileList environmentProfiles(KSharedConfig::openConfig());
536 QString environmentProfile = m_owner->environmentProfile();
537 if( environmentProfile.isEmpty() ) {
538 environmentProfile = environmentProfiles.defaultProfileName();
539 }
540 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
541 auto userEnv = environmentProfiles.variables(environmentProfile);
542 expandVariables(userEnv, environment);
543
544 OutputExecuteJobPrivate::mergeEnvironment( environment, userEnv );
545 OutputExecuteJobPrivate::mergeEnvironment( environment, m_environmentOverrides );
546 if( m_properties.testFlag( OutputExecuteJob::PortableMessages ) ) {
547 environment.remove( QStringLiteral( "LC_ALL" ) );
548 environment.insert( QStringLiteral( "LC_MESSAGES" ), QStringLiteral( "C" ) );
549 }
550 if (!workingDirectory.isEmpty() && environment.contains(QStringLiteral("PWD"))) {
551 // also update the environment variable for the cwd, otherwise scripts can break easily
552 environment.insert(QStringLiteral("PWD"), workingDirectory.toLocalFile());
553 }
554 return environment;
555}
556
557QString OutputExecuteJobPrivate::joinCommandLine() const
558{

Callers 1

startMethod · 0.80

Calls 8

defaultProfileNameMethod · 0.80
toLocalFileMethod · 0.80
environmentProfileMethod · 0.45
isEmptyMethod · 0.45
variablesMethod · 0.45
removeMethod · 0.45
insertMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected