MCPcopy Create free account
hub / github.com/commontk/CTK / setModules

Method setModules

Libs/CommandLineModules/Core/ctkCmdLineModuleDirectoryWatcher.cpp:328–396  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

326
327//-----------------------------------------------------------------------------
328void ctkCmdLineModuleDirectoryWatcherPrivate::setModules(const QStringList &directories)
329{
330 // Note: This method, is called from setDirectories and updateModules,
331 // so the input directories list may be longer or shorter than the currently watched directories.
332 // In addition, within those directories, programs may have been added/removed.
333
334 QString path;
335 QStringList currentlyWatchedDirectories = this->directories();
336
337 QStringList modulesToUnload;
338 QStringList modulesToLoad;
339
340 // First remove modules from current directories that are no longer in the requested "directories" list.
341 foreach (path, currentlyWatchedDirectories)
342 {
343 if (!directories.contains(path))
344 {
345 QStringList currentlyWatchedFiles = this->extractCurrentlyWatchedFilenamesInDirectory(path);
346
347 QString filename;
348 foreach (filename, currentlyWatchedFiles)
349 {
350 modulesToUnload << filename;
351 }
352 }
353 }
354
355 // Now for each requested directory.
356 foreach (path, directories)
357 {
358 // Existing folder.
359 if (currentlyWatchedDirectories.contains(path))
360 {
361 QStringList currentlyWatchedFiles = this->extractCurrentlyWatchedFilenamesInDirectory(path);
362 QStringList executablesInDirectory = this->getExecutablesInDirectory(path);
363
364 QString executable;
365 foreach (executable, currentlyWatchedFiles)
366 {
367 if (!executablesInDirectory.contains(executable))
368 {
369 modulesToUnload << executable;
370 }
371 }
372
373 foreach(executable, executablesInDirectory)
374 {
375 if (!currentlyWatchedFiles.contains(executable))
376 {
377 modulesToLoad << executable;
378 }
379 }
380 }
381 else
382 {
383 // New folder
384 QStringList executables = this->getExecutablesInDirectory(path);
385

Callers 2

setDirectoriesMethod · 0.95
updateModulesMethod · 0.95

Calls 3

unloadModulesMethod · 0.95
loadModulesMethod · 0.95
directoriesMethod · 0.45

Tested by

no test coverage detected