void CMakeRunConfigurationWidget::environmentWasChanged()
{
    ProjectExplorer::EnvironmentAspect *aspect
        = m_cmakeRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
    QTC_ASSERT(aspect, return);
    m_workingDirectoryEdit->setEnvironment(aspect->environment());
}
LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
        RunConfiguration *runConfiguration,
        const Analyzer::AnalyzerStartParameters &sp,
        QString *errorMessage,
        QmlProfilerRunControl *engine)
{
    LocalApplicationRunConfiguration *larc =
                   qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
    QTC_ASSERT(larc, return 0);
    ProjectExplorer::EnvironmentAspect *environment
            = runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
    QTC_ASSERT(environment, return 0);
    Configuration conf;
    conf.executable = larc->executable();
    conf.executableArguments = larc->commandLineArguments();
    conf.workingDirectory = larc->workingDirectory();
    conf.environment = environment->environment();

    conf.port = sp.analyzerPort;

    if (conf.executable.isEmpty()) {
        if (errorMessage)
            *errorMessage = tr("No executable file to launch.");
        return 0;
    }
    return new LocalQmlProfilerRunner(conf, engine);
}
QString CMakeRunConfiguration::workingDirectory() const
{
    ProjectExplorer::EnvironmentAspect *aspect = extraAspect<ProjectExplorer::EnvironmentAspect>();
    QTC_ASSERT(aspect, return QString());
    return QDir::cleanPath(aspect->environment().expandVariables(
                               Utils::expandMacros(baseWorkingDirectory(), macroExpander())));
}