From 5adeb48e52c54c3c2385800f3f00ccda35d3050c Mon Sep 17 00:00:00 2001 From: dt <qtc-committer@nokia.com> Date: Mon, 27 Sep 2010 15:04:58 +0100 Subject: [PATCH] ApplicationRC: make exectuable() and co. return expanded values --- .../cmakerunconfiguration.cpp | 16 +++++++++++++--- .../cmakeprojectmanager/cmakerunconfiguration.h | 2 ++ src/plugins/debugger/debuggerrunner.cpp | 6 +++--- .../applicationrunconfiguration.cpp | 6 +++--- .../customexecutablerunconfiguration.cpp | 17 ++++++++++++++--- .../customexecutablerunconfiguration.h | 2 ++ .../qt4projectmanager/qt4runconfiguration.cpp | 17 ++++++++++++++--- .../qt4projectmanager/qt4runconfiguration.h | 2 ++ 8 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index acf0102d65f..283f5dd0f68 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -132,6 +132,11 @@ ProjectExplorer::LocalApplicationRunConfiguration::RunMode CMakeRunConfiguration } QString CMakeRunConfiguration::workingDirectory() const +{ + return environment().expandVariables(baseWorkingDirectory()); +} + +QString CMakeRunConfiguration::baseWorkingDirectory() const { if (!m_userWorkingDirectory.isEmpty()) return m_userWorkingDirectory; @@ -139,6 +144,11 @@ QString CMakeRunConfiguration::workingDirectory() const } QStringList CMakeRunConfiguration::commandLineArguments() const +{ + return environment().expandVariables(baseCommandLineArguments()); +} + +QStringList CMakeRunConfiguration::baseCommandLineArguments() const { return Utils::Environment::parseCombinedArgString(m_arguments); } @@ -155,7 +165,7 @@ void CMakeRunConfiguration::setExecutable(const QString &executable) void CMakeRunConfiguration::setWorkingDirectory(const QString &wd) { - const QString & oldWorkingDirectory = workingDirectory(); + const QString &oldWorkingDirectory = workingDirectory(); m_workingDirectory = wd; @@ -326,14 +336,14 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration * fl->setMargin(0); fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); QLineEdit *argumentsLineEdit = new QLineEdit(); - argumentsLineEdit->setText(Utils::Environment::joinArgumentList(cmakeRunConfiguration->commandLineArguments())); + argumentsLineEdit->setText(Utils::Environment::joinArgumentList(cmakeRunConfiguration->baseCommandLineArguments())); connect(argumentsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setArguments(QString))); fl->addRow(tr("Arguments:"), argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(); m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory()); - m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->workingDirectory()); + m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory()); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h index 0e9198e23db..09b25d6ba51 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h @@ -104,6 +104,8 @@ protected: QString defaultDisplayName() const; private: + QString baseWorkingDirectory() const; + QStringList baseCommandLineArguments() const; void ctor(); enum BaseEnvironmentBase { CleanEnvironmentBase = 0, diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index a239d3ac28e..69f739b8500 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -148,9 +148,9 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu sp.startMode = StartInternal; sp.environment = rc->environment().toStringList(); - sp.workingDirectory = rc->environment().expandVariables(rc->workingDirectory()); - sp.executable = rc->environment().searchInPath(rc->executable(), QStringList() << sp.workingDirectory); - sp.processArgs = rc->environment().expandVariables(rc->commandLineArguments()); + sp.workingDirectory = rc->workingDirectory(); + sp.executable = rc->executable(); + sp.processArgs = rc->commandLineArguments(); sp.toolChainType = rc->toolChainType(); sp.useTerminal = rc->runMode() == LocalApplicationRunConfiguration::Console; sp.dumperLibrary = rc->dumperLibrary(); diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.cpp b/src/plugins/projectexplorer/applicationrunconfiguration.cpp index bdd0fbc85ae..3ef50e961e6 100644 --- a/src/plugins/projectexplorer/applicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/applicationrunconfiguration.cpp @@ -95,13 +95,13 @@ LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfig : RunControl(rc, mode) { Utils::Environment env = rc->environment(); - QString dir = env.expandVariables(rc->workingDirectory()); + QString dir = rc->workingDirectory(); m_applicationLauncher.setEnvironment(env.toStringList()); m_applicationLauncher.setWorkingDirectory(dir); - m_executable = env.searchInPath(rc->executable(), QStringList() << dir); + m_executable = rc->executable(); m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode()); - m_commandLineArguments = env.expandVariables(rc->commandLineArguments()); + m_commandLineArguments = rc->commandLineArguments(); connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)), this, SLOT(slotAppendMessage(QString,bool))); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 475b24f7ef8..a72c44dd74d 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -281,8 +281,8 @@ void CustomExecutableConfigurationWidget::changed() if (m_ignoreChange) return; m_executableChooser->setPath(executable); - m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); - m_workingDirectory->setPath(m_runConfiguration->workingDirectory()); + m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments())); + m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory()); m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console); } @@ -343,7 +343,7 @@ void CustomExecutableRunConfiguration::activeBuildConfigurationChanged() QString CustomExecutableRunConfiguration::executable() const { Utils::Environment env = environment(); - QString exec = env.searchInPath(m_executable, QStringList() << env.expandVariables(workingDirectory())); + QString exec = env.searchInPath(m_executable, QStringList() << workingDirectory()); if (exec.isEmpty() || !QFileInfo(exec).exists()) { // Oh the executable doesn't exists, ask the user. @@ -395,11 +395,22 @@ LocalApplicationRunConfiguration::RunMode CustomExecutableRunConfiguration::runM } QString CustomExecutableRunConfiguration::workingDirectory() const +{ + return environment().expandVariables(baseWorkingDirectory()); +} + +QString CustomExecutableRunConfiguration::baseWorkingDirectory() const { return m_workingDirectory; } + QStringList CustomExecutableRunConfiguration::commandLineArguments() const +{ + return environment().expandVariables(baseCommandLineArguments()); +} + +QStringList CustomExecutableRunConfiguration::baseCommandLineArguments() const { return m_cmdArguments; } diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h index ed413867f95..7be085fb4ed 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h @@ -124,6 +124,8 @@ private: void setExecutable(const QString &executable); void setCommandLineArguments(const QString &commandLineArguments); + QStringList baseCommandLineArguments() const; + QString baseWorkingDirectory() const; void setWorkingDirectory(const QString &workingDirectory); void setUserName(const QString &name); void setRunMode(RunMode runMode); diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index b5fe3731ea8..be286be1ab9 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -201,12 +201,12 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run toplayout->addRow(tr("Executable:"), m_executableLineEdit); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); - m_argumentsLineEdit = new QLineEdit(Utils::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()), this); + m_argumentsLineEdit = new QLineEdit(Utils::Environment::joinArgumentList(qt4RunConfiguration->baseCommandLineArguments()), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(this); - m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->workingDirectory()); + m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->baseWorkingDirectory()); m_workingDirectoryEdit->setBaseDirectory(m_qt4RunConfiguration->target()->project()->projectDirectory()); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); m_workingDirectoryEdit->setEnvironment(m_qt4RunConfiguration->environment()); @@ -442,7 +442,7 @@ void Qt4RunConfigurationWidget::effectiveTargetInformationChanged() if (m_isShown) { m_executableLineEdit->setText(QDir::toNativeSeparators(m_qt4RunConfiguration->executable())); m_ignoreChange = true; - m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->workingDirectory())); + m_workingDirectoryEdit->setPath(QDir::toNativeSeparators(m_qt4RunConfiguration->baseWorkingDirectory())); m_ignoreChange = false; } } @@ -524,6 +524,11 @@ void Qt4RunConfiguration::setUsingDyldImageSuffix(bool state) } QString Qt4RunConfiguration::workingDirectory() const +{ + return environment().expandVariables(baseWorkingDirectory()); +} + +QString Qt4RunConfiguration::baseWorkingDirectory() const { // if the user overrode us, then return his working directory if (m_userSetWokingDirectory) @@ -537,6 +542,12 @@ QString Qt4RunConfiguration::workingDirectory() const return ti.workingDir; } + +QStringList Qt4RunConfiguration::baseCommandLineArguments() const +{ + return environment().expandVariables(commandLineArguments()); +} + QStringList Qt4RunConfiguration::commandLineArguments() const { return m_commandLineArguments; diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index 92db6616005..1c6ee44cd7d 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -118,6 +118,8 @@ protected: virtual bool fromMap(const QVariantMap &map); private: + QString baseWorkingDirectory() const; + QStringList baseCommandLineArguments() const; enum BaseEnvironmentBase { CleanEnvironmentBase = 0, SystemEnvironmentBase = 1, BuildEnvironmentBase = 2 }; -- GitLab