| 201 | } |
| 202 | |
| 203 | void BlockedModsDialog::watchPath(QString path, bool watch_recursive) |
| 204 | { |
| 205 | auto to_watch = QFileInfo(path); |
| 206 | if (!to_watch.isReadable()) { |
| 207 | qWarning() << "[Blocked Mods Dialog] Failed to add Watch Path (unable to read):" << path; |
| 208 | return; |
| 209 | } |
| 210 | auto to_watch_path = to_watch.canonicalFilePath(); |
| 211 | if (m_watcher.directories().contains(to_watch_path)) |
| 212 | return; // don't watch the same path twice (no loops!) |
| 213 | |
| 214 | qDebug() << "[Blocked Mods Dialog] Adding Watch Path:" << path; |
| 215 | m_watcher.addPath(to_watch_path); |
| 216 | |
| 217 | if (!to_watch.isDir() || !watch_recursive) |
| 218 | return; |
| 219 | |
| 220 | QDirIterator it(to_watch_path, QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot, QDirIterator::NoIteratorFlags); |
| 221 | while (it.hasNext()) { |
| 222 | QString watch_dir = QDir(it.next()).canonicalPath(); // resolve symlinks and relative paths |
| 223 | watchPath(watch_dir, watch_recursive); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | /// @brief scan all watched folder |
| 228 | void BlockedModsDialog::scanPaths() |
nothing calls this directly
no test coverage detected