| 111 | |
| 112 | |
| 113 | QUrl ExecutePlugin::executable( KDevelop::ILaunchConfiguration* cfg, QString& err ) const |
| 114 | { |
| 115 | QUrl executable; |
| 116 | if( !cfg ) |
| 117 | { |
| 118 | return executable; |
| 119 | } |
| 120 | KConfigGroup grp = cfg->config(); |
| 121 | if( grp.readEntry(ExecutePlugin::isExecutableEntry, false ) ) |
| 122 | { |
| 123 | executable = grp.readEntry( ExecutePlugin::executableEntry, QUrl() ); |
| 124 | } else |
| 125 | { |
| 126 | QStringList prjitem = grp.readEntry( ExecutePlugin::projectTargetEntry, QStringList() ); |
| 127 | KDevelop::ProjectModel* model = KDevelop::ICore::self()->projectController()->projectModel(); |
| 128 | KDevelop::ProjectBaseItem* item = model->itemFromIndex( model->pathToIndex(prjitem) ); |
| 129 | if( item && item->executable() ) |
| 130 | { |
| 131 | // TODO: Need an option in the gui to choose between installed and builddir url here, currently cmake only supports builddir url |
| 132 | executable = item->executable()->builtUrl(); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // Do not pass err to splitLocalFileLaunchConfigurationEntry(), because it may be nonempty from the beginning. |
| 137 | QString initiallyEmptyErrorMessage; |
| 138 | splitLocalFileLaunchConfigurationEntry( |
| 139 | *cfg, executable, |
| 140 | LaunchConfigurationEntryName{"executable path", i18nc("path to an executable", "executable path")}, |
| 141 | initiallyEmptyErrorMessage); |
| 142 | if (initiallyEmptyErrorMessage.isEmpty()) { |
| 143 | return executable; |
| 144 | } |
| 145 | |
| 146 | err = std::move(initiallyEmptyErrorMessage); |
| 147 | return {}; |
| 148 | } |
| 149 | |
| 150 | |
| 151 | bool ExecutePlugin::useTerminal( KDevelop::ILaunchConfiguration* cfg ) const |
no test coverage detected