diff --git a/Code/ApplicationEngine/otbWrapperApplicationRegistry.cxx b/Code/ApplicationEngine/otbWrapperApplicationRegistry.cxx index 43ea6ffb139c587705a7a8f6366ba6ee9928122a..b92d4ba2436c49f46aeea737e67a04395c318dfc 100644 --- a/Code/ApplicationEngine/otbWrapperApplicationRegistry.cxx +++ b/Code/ApplicationEngine/otbWrapperApplicationRegistry.cxx @@ -132,22 +132,20 @@ ApplicationRegistry::GetAvailableApplications() } } - // Return the app list - std::vector<std::string> availableApp; + // Get all the app names + // If ITK_AUTOLOAD_PATH contains several times the same path, then the same app appear several times + // Use a temporary std::set to fix this + std::set<std::string> appSet; for(std::list<ApplicationPointer>::iterator k = possibleApp.begin(); k != possibleApp.end(); ++k) { (*k)->Init(); - availableApp.push_back((*k)->GetName()); + appSet.insert((*k)->GetName()); } - // If the ITK_AUTOLOAD_PATH contains - // several times the same path, application will appears several - // times in the list.To be cleaner, we erase multiple - std::vector<std::string>::iterator it; - it = std::unique(availableApp.begin(), availableApp.end()); - availableApp.resize( it - availableApp.begin() ); - - return availableApp; + + std::vector<std::string> appVec; + std::copy(appSet.begin(), appSet.end(), std::back_inserter(appVec)); + return appVec; }