Changeset View
Changeset View
Standalone View
Standalone View
plugins/executescript/scriptappjob.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 52 | { | |||
---|---|---|---|---|---|
124 | if( error() != 0 ) | 124 | if( error() != 0 ) | ||
125 | { | 125 | { | ||
126 | qCWarning(PLUGIN_EXECUTESCRIPT) << "Launch Configuration:" << cfg->name() << "oops, problem" << errorText(); | 126 | qCWarning(PLUGIN_EXECUTESCRIPT) << "Launch Configuration:" << cfg->name() << "oops, problem" << errorText(); | ||
127 | return; | 127 | return; | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | auto currentFilterMode = static_cast<KDevelop::OutputModel::OutputFilterStrategy>( iface->outputFilterModeId( cfg ) ); | 130 | auto currentFilterMode = static_cast<KDevelop::OutputModel::OutputFilterStrategy>( iface->outputFilterModeId( cfg ) ); | ||
131 | 131 | | |||
132 | QUrl wc = iface->workingDirectory( cfg ); | ||||
133 | if( !wc.isValid() || wc.isEmpty() ) | ||||
134 | { | ||||
135 | qCWarning(PLUGIN_EXECUTESCRIPT) << "Launch Configuration:" << cfg->name() << "no valid working directory: " << wc; | ||||
136 | wc = QUrl::fromLocalFile( QFileInfo( script.toLocalFile() ).absolutePath() ); | ||||
137 | qCWarning(PLUGIN_EXECUTESCRIPT) << "Assuming working directory:" << wc; | ||||
138 | } | ||||
139 | QUrl localwc( ICore::self()->runtimeController()->currentRuntime()->pathInRuntime(KDevelop::Path(wc)).toUrl() ); | ||||
140 | | ||||
132 | setStandardToolView(KDevelop::IOutputView::RunView); | 141 | setStandardToolView(KDevelop::IOutputView::RunView); | ||
133 | setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll); | 142 | setBehaviours(KDevelop::IOutputView::AllowUserClose | KDevelop::IOutputView::AutoScroll); | ||
134 | auto* m = new KDevelop::OutputModel; | 143 | auto* m = new KDevelop::OutputModel(localwc); | ||
135 | m->setFilteringStrategy(currentFilterMode); | 144 | m->setFilteringStrategy(currentFilterMode); | ||
136 | setModel( m ); | 145 | setModel( m ); | ||
137 | setDelegate( new KDevelop::OutputDelegate ); | 146 | setDelegate( new KDevelop::OutputDelegate ); | ||
138 | 147 | | |||
139 | connect( lineMaker, &ProcessLineMaker::receivedStdoutLines, model(), &OutputModel::appendLines ); | 148 | connect( lineMaker, &ProcessLineMaker::receivedStdoutLines, model(), &OutputModel::appendLines ); | ||
140 | connect(proc, &QProcess::errorOccurred, this, &ScriptAppJob::processError); | 149 | connect(proc, &QProcess::errorOccurred, this, &ScriptAppJob::processError); | ||
141 | connect( proc, QOverload<int,QProcess::ExitStatus>::of(&QProcess::finished), this, &ScriptAppJob::processFinished ); | 150 | connect( proc, QOverload<int,QProcess::ExitStatus>::of(&QProcess::finished), this, &ScriptAppJob::processFinished ); | ||
142 | 151 | | |||
143 | // Now setup the process parameters | 152 | // Now setup the process parameters | ||
144 | 153 | | |||
145 | proc->setEnvironment(environmentProfiles.createEnvironment(envProfileName, proc->systemEnvironment())); | 154 | proc->setEnvironment(environmentProfiles.createEnvironment(envProfileName, proc->systemEnvironment())); | ||
146 | QUrl wc = iface->workingDirectory( cfg ); | 155 | proc->setWorkingDirectory( localwc.toLocalFile() ); | ||
147 | if( !wc.isValid() || wc.isEmpty() ) | | |||
148 | { | | |||
149 | wc = QUrl::fromLocalFile( QFileInfo( script.toLocalFile() ).absolutePath() ); | | |||
150 | } | | |||
151 | proc->setWorkingDirectory( ICore::self()->runtimeController()->currentRuntime()->pathInRuntime(KDevelop::Path(wc)).toLocalFile() ); | | |||
152 | proc->setProperty( "executable", interpreter.first() ); | 156 | proc->setProperty( "executable", interpreter.first() ); | ||
153 | 157 | | |||
154 | QStringList program; | 158 | QStringList program; | ||
155 | if (!remoteHost.isEmpty()) { | 159 | if (!remoteHost.isEmpty()) { | ||
156 | program << QStringLiteral("ssh"); | 160 | program << QStringLiteral("ssh"); | ||
157 | QStringList parts = remoteHost.split(QLatin1Char(':')); | 161 | QStringList parts = remoteHost.split(QLatin1Char(':')); | ||
158 | program << parts.first(); | 162 | program << parts.first(); | ||
159 | if (parts.length() > 1) { | 163 | if (parts.length() > 1) { | ||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |