Skip to content
Snippets Groups Projects
Commit 50f9165b authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Handle environment variables when starting an application

 * Handle environment variables in workdir, executable name as
   well as arguments when starting an application
 * Cover both debugger and normal application starts
parent e9f412c3
No related branches found
No related tags found
No related merge requests found
......@@ -147,10 +147,10 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
QTC_ASSERT(rc, return sp);
sp.startMode = StartInternal;
sp.executable = rc->executable();
sp.environment = rc->environment().toStringList();
sp.workingDirectory = rc->workingDirectory();
sp.processArgs = rc->commandLineArguments();
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.toolChainType = rc->toolChainType();
sp.useTerminal = rc->runMode() == LocalApplicationRunConfiguration::Console;
sp.dumperLibrary = rc->dumperLibrary();
......
......@@ -91,15 +91,17 @@ QWidget *LocalApplicationRunControlFactory::createConfigurationWidget(RunConfigu
// ApplicationRunControl
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *runConfiguration, QString mode)
: RunControl(runConfiguration, mode)
LocalApplicationRunControl::LocalApplicationRunControl(LocalApplicationRunConfiguration *rc, QString mode)
: RunControl(rc, mode)
{
m_applicationLauncher.setEnvironment(runConfiguration->environment().toStringList());
m_applicationLauncher.setWorkingDirectory(runConfiguration->workingDirectory());
Utils::Environment env = rc->environment();
QString dir = env.expandVariables(rc->workingDirectory());
m_applicationLauncher.setEnvironment(env.toStringList());
m_applicationLauncher.setWorkingDirectory(dir);
m_executable = runConfiguration->executable();
m_runMode = static_cast<ApplicationLauncher::Mode>(runConfiguration->runMode());
m_commandLineArguments = runConfiguration->commandLineArguments();
m_executable = env.searchInPath(rc->executable(), QStringList() << dir);
m_runMode = static_cast<ApplicationLauncher::Mode>(rc->runMode());
m_commandLineArguments = env.expandVariables(rc->commandLineArguments());
connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
this, SLOT(slotAppendMessage(QString,bool)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment