| 531 | } |
| 532 | |
| 533 | QProcessEnvironment 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 | |
| 557 | QString OutputExecuteJobPrivate::joinCommandLine() const |
| 558 | { |
no test coverage detected