| 159 | } |
| 160 | |
| 161 | QStringList ExecutePlugin::terminal(KDevelop::ILaunchConfiguration* cfg, QString& error) const |
| 162 | { |
| 163 | if( !cfg ) |
| 164 | { |
| 165 | return {}; |
| 166 | } |
| 167 | auto terminalCommand = cfg->config().readEntry(ExecutePlugin::terminalEntry, QString{}); |
| 168 | |
| 169 | // Keep old external terminal config working and (mostly) preserve backward compatibility: |
| 170 | { |
| 171 | // 1) remove an obsolete placeholder %exe from the end of the command |
| 172 | constexpr QLatin1String exePlaceholder("%exe"); |
| 173 | if (terminalCommand.endsWith(exePlaceholder)) { |
| 174 | terminalCommand.chop(exePlaceholder.size()); |
| 175 | qCWarning(PLUGIN_EXECUTE).nospace() |
| 176 | << "the external terminal command for the launch configuration " << cfg->name() |
| 177 | << " ends with an obsolete placeholder " << exePlaceholder << ", please remove it"; |
| 178 | } |
| 179 | |
| 180 | // 2) remove obsolete --workdir arguments to konsole |
| 181 | constexpr QLatin1String workdirArguments("--workdir %workdir"); |
| 182 | const auto previousSize = terminalCommand.size(); |
| 183 | terminalCommand.remove(workdirArguments); |
| 184 | if (terminalCommand.size() != previousSize) { |
| 185 | Q_ASSERT(terminalCommand.size() + workdirArguments.size() <= previousSize); |
| 186 | qCWarning(PLUGIN_EXECUTE).nospace() |
| 187 | << "the external terminal command for the launch configuration " << cfg->name() |
| 188 | << " contains obsolete arguments " << workdirArguments << ", please remove them"; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | return splitNonemptyLaunchConfigurationEntry( |
| 193 | *cfg, terminalCommand, |
| 194 | LaunchConfigurationEntryName{"external terminal command", i18n("external terminal command")}, error); |
| 195 | } |
| 196 | |
| 197 | |
| 198 | QUrl ExecutePlugin::workingDirectory( KDevelop::ILaunchConfiguration* cfg ) const |