| 98 | } |
| 99 | |
| 100 | void AttachInfoDialog::updateProcess() |
| 101 | { |
| 102 | model->removeRows(1, model->rowCount() - 1); |
| 103 | |
| 104 | QStringList procList = QDir("/proc").entryList(QDir::Dirs | QDir::NoDotAndDotDot); |
| 105 | for (const QString &pid : procList) { |
| 106 | QString exePath = QString("/proc/%1/exe").arg(pid); |
| 107 | if (QFile::exists(exePath)) { |
| 108 | QFileInfo fileInfo(exePath); |
| 109 | QString path = fileInfo.symLinkTarget(); |
| 110 | if (path.isEmpty()) { |
| 111 | path = exePath; |
| 112 | } |
| 113 | |
| 114 | model->appendRow({new QStandardItem(pid), new QStandardItem(path)}); |
| 115 | } |
| 116 | } |
| 117 | } |