MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / addAsExecutable

Method addAsExecutable

src/filetree.cpp:263–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void FileTree::addAsExecutable(FileTreeItem* item)
264{
265 if (!item) {
266 item = singleSelection();
267
268 if (!item) {
269 return;
270 }
271 }
272
273 const QString path = item->realPath();
274 const QFileInfo target(path);
275 const auto fec = spawn::getFileExecutionContext(m_tree->window(), target);
276
277 switch (fec.type) {
278 case spawn::FileExecutionTypes::Executable: {
279 const QString name = QInputDialog::getText(
280 m_tree->window(), tr("Enter Name"), tr("Enter a name for the executable"),
281 QLineEdit::Normal, target.completeBaseName());
282
283 if (!name.isEmpty()) {
284 // Note: If this already exists, you'll lose custom settings
285 m_core.executablesList()->setExecutable(
286 Executable()
287 .title(name)
288 .binaryInfo(fec.binary)
289 .arguments(fec.arguments)
290 .workingDirectory(target.absolutePath()));
291
292 emit executablesChanged();
293 }
294
295 break;
296 }
297
298 case spawn::FileExecutionTypes::Other: // fall-through
299 default: {
300 QMessageBox::information(m_tree->window(), tr("Not an executable"),
301 tr("This is not a recognized executable."));
302
303 break;
304 }
305 }
306}
307
308void FileTree::exploreOrigin(FileTreeItem* item)
309{

Callers

nothing calls this directly

Calls 6

getFileExecutionContextFunction · 0.85
setExecutableMethod · 0.80
executablesListMethod · 0.80
ExecutableClass · 0.70
isEmptyMethod · 0.45
absolutePathMethod · 0.45

Tested by

no test coverage detected