Browse Source

Projucer: Removed the jobNeedsRunningAgain logic from AvailableModuleList's ModuleScannerJob as it was causing the job to hang when the module was found in the root directory

tags/2021-05-28
ed 6 years ago
parent
commit
8495d429ff
1 changed files with 11 additions and 16 deletions
  1. +11
    -16
      extras/Projucer/Source/Project/jucer_Module.cpp

+ 11
- 16
extras/Projucer/Source/Project/jucer_Module.cpp View File

@@ -125,7 +125,7 @@ static bool tryToAddModuleFromFolder (const File& path, ModuleIDAndFolderList& l
return false; return false;
} }
static bool addAllModulesInSubfoldersRecursively (const File& path, int depth, ModuleIDAndFolderList& list)
static void addAllModulesInSubfoldersRecursively (const File& path, int depth, ModuleIDAndFolderList& list)
{ {
if (depth > 0) if (depth > 0)
{ {
@@ -133,30 +133,23 @@ static bool addAllModulesInSubfoldersRecursively (const File& path, int depth, M
{ {
if (auto* job = ThreadPoolJob::getCurrentThreadPoolJob()) if (auto* job = ThreadPoolJob::getCurrentThreadPoolJob())
if (job->shouldExit()) if (job->shouldExit())
return false;
return;
auto childPath = iter.getFile().getLinkedTarget(); auto childPath = iter.getFile().getLinkedTarget();
if (! tryToAddModuleFromFolder (childPath, list)) if (! tryToAddModuleFromFolder (childPath, list))
if (! addAllModulesInSubfoldersRecursively (childPath, depth - 1, list))
return false;
addAllModulesInSubfoldersRecursively (childPath, depth - 1, list);
} }
} }
return true;
} }
static bool addAllModulesInFolder (const File& path, ModuleIDAndFolderList& list)
static void addAllModulesInFolder (const File& path, ModuleIDAndFolderList& list)
{ {
bool exitedBeforeCompletion = false;
if (! tryToAddModuleFromFolder (path, list)) if (! tryToAddModuleFromFolder (path, list))
{ {
int subfolders = 3; int subfolders = 3;
exitedBeforeCompletion = addAllModulesInSubfoldersRecursively (path, subfolders, list);
addAllModulesInSubfoldersRecursively (path, subfolders, list);
} }
return exitedBeforeCompletion;
} }
static void sort (ModuleIDAndFolderList& listToSort) static void sort (ModuleIDAndFolderList& listToSort)
@@ -182,11 +175,13 @@ struct ModuleScannerJob : public ThreadPoolJob
ModuleIDAndFolderList list; ModuleIDAndFolderList list;
for (auto& p : pathsToScan) for (auto& p : pathsToScan)
if (! addAllModulesInFolder (p, list))
return jobNeedsRunningAgain;
addAllModulesInFolder (p, list);
sort (list);
completionCallback (list);
if (! shouldExit())
{
sort (list);
completionCallback (list);
}
return jobHasFinished; return jobHasFinished;
} }


Loading…
Cancel
Save