mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Fixed: Don't process again same directory
--HG-- branch : develop
This commit is contained in:
parent
fd1344a12e
commit
9a573dfd6c
1 changed files with 9 additions and 8 deletions
|
@ -678,12 +678,9 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
|
|||
if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix()));
|
||||
#endif
|
||||
|
||||
std::vector<std::string> directoriesToProcess;
|
||||
std::map<std::string, sint> directoriesToProcess;
|
||||
|
||||
// reserve maximum memory space for all combinations
|
||||
directoriesToProcess.reserve(directoryPrefixes.size() * paths.size());
|
||||
|
||||
// first pass, build a vector with all existing directories to process in second pass
|
||||
// first pass, build a map with all existing directories to process in second pass
|
||||
for (uint j = 0; j < directoryPrefixes.size(); j++)
|
||||
{
|
||||
std::string directoryPrefix = directoryPrefixes[j];
|
||||
|
@ -698,15 +695,17 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
|
|||
|
||||
// only process existing directories
|
||||
if (CFile::isExists(directory))
|
||||
directoriesToProcess.push_back(directory);
|
||||
directoriesToProcess[directory] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
uint total = (uint)directoriesToProcess.size();
|
||||
uint current = 0, next = 0;
|
||||
|
||||
std::map<std::string, sint>::const_iterator it = directoriesToProcess.begin(), iend = directoriesToProcess.end();
|
||||
|
||||
// second pass, add search paths
|
||||
for (uint i = 0, len = directoriesToProcess.size(); i < len; ++i)
|
||||
while (it != iend)
|
||||
{
|
||||
// update next progress value
|
||||
++next;
|
||||
|
@ -717,9 +716,11 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
|
|||
// next is current value
|
||||
current = next;
|
||||
|
||||
CPath::addSearchPath(directoriesToProcess[i], recurse, false, &progress);
|
||||
CPath::addSearchPath(it->first, recurse, false, &progress);
|
||||
|
||||
progress.popCropedValues();
|
||||
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue