MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / watchPath

Method watchPath

launcher/ui/dialogs/BlockedModsDialog.cpp:203–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void 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
228void BlockedModsDialog::scanPaths()

Callers

nothing calls this directly

Calls 5

QFileInfoClass · 0.85
canonicalFilePathMethod · 0.80
addPathMethod · 0.80
QDirClass · 0.50
containsMethod · 0.45

Tested by

no test coverage detected