Merge pull request #20848 from alalek:reverse_plugins_candidates_order

This commit is contained in:
Alexander Alekhin 2021-10-09 15:45:17 +00:00
commit 023e86d68f
3 changed files with 9 additions and 0 deletions

View File

@ -223,6 +223,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
continue; continue;
std::vector<std::string> candidates; std::vector<std::string> candidates;
cv::glob(utils::fs::join(path, plugin_expr), candidates); cv::glob(utils::fs::join(path, plugin_expr), candidates);
// Prefer candisates with higher versions
// TODO: implemented accurate versions-based comparator
std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
CV_LOG_DEBUG(NULL, " - " << path << ": " << candidates.size()); CV_LOG_DEBUG(NULL, " - " << path << ": " << candidates.size());
copy(candidates.begin(), candidates.end(), back_inserter(results)); copy(candidates.begin(), candidates.end(), back_inserter(results));
} }

View File

@ -224,6 +224,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
continue; continue;
std::vector<std::string> candidates; std::vector<std::string> candidates;
cv::glob(utils::fs::join(path, plugin_expr), candidates); cv::glob(utils::fs::join(path, plugin_expr), candidates);
// Prefer candisates with higher versions
// TODO: implemented accurate versions-based comparator
std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
CV_LOG_DEBUG(NULL, " - " << path << ": " << candidates.size()); CV_LOG_DEBUG(NULL, " - " << path << ": " << candidates.size());
copy(candidates.begin(), candidates.end(), back_inserter(results)); copy(candidates.begin(), candidates.end(), back_inserter(results));
} }

View File

@ -373,6 +373,9 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
continue; continue;
std::vector<std::string> candidates; std::vector<std::string> candidates;
cv::glob(utils::fs::join(path, plugin_expr), candidates); cv::glob(utils::fs::join(path, plugin_expr), candidates);
// Prefer candisates with higher versions
// TODO: implemented accurate versions-based comparator
std::sort(candidates.begin(), candidates.end(), std::greater<std::string>());
CV_LOG_INFO(NULL, " - " << path << ": " << candidates.size()); CV_LOG_INFO(NULL, " - " << path << ": " << candidates.size());
copy(candidates.begin(), candidates.end(), back_inserter(results)); copy(candidates.begin(), candidates.end(), back_inserter(results));
} }