From 1efdb426f70cc2894bdd92d1df1e67c58a208e62 Mon Sep 17 00:00:00 2001 From: "Hunter L. Allen" Date: Thu, 18 Jan 2024 15:06:52 -0500 Subject: [PATCH] Remove redundant throw of a std::runtime_error (#232) Signed-off-by: Hunter L. Allen --- .../include/pluginlib/class_loader_imp.hpp | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/pluginlib/include/pluginlib/class_loader_imp.hpp b/pluginlib/include/pluginlib/class_loader_imp.hpp index 89578e6..ff50b21 100644 --- a/pluginlib/include/pluginlib/class_loader_imp.hpp +++ b/pluginlib/include/pluginlib/class_loader_imp.hpp @@ -393,31 +393,27 @@ std::vector ClassLoader::getAllLibraryPathsToTry( } std::string stripped_library_name_alternative = stripAllButFileFromPath(library_name_alternative); - try { - // Setup the relative file paths to pair with the search directories above. - std::vector all_relative_library_paths = { - rcpputils::get_platform_library_name(library_name), - rcpputils::get_platform_library_name(library_name_alternative), - rcpputils::get_platform_library_name(stripped_library_name), - rcpputils::get_platform_library_name(stripped_library_name_alternative) - }; - std::vector all_relative_debug_library_paths = { - rcpputils::get_platform_library_name(library_name, true), - rcpputils::get_platform_library_name(library_name_alternative, true), - rcpputils::get_platform_library_name(stripped_library_name, true), - rcpputils::get_platform_library_name(stripped_library_name_alternative, true) - }; - - for (auto && current_search_path : all_search_paths) { - for (auto && current_library_path : all_relative_library_paths) { - all_paths.push_back(current_search_path + path_separator + current_library_path); - } - for (auto && current_library_path : all_relative_debug_library_paths) { - all_paths.push_back(current_search_path + path_separator + current_library_path); - } + // Setup the relative file paths to pair with the search directories above. + std::vector all_relative_library_paths = { + rcpputils::get_platform_library_name(library_name), + rcpputils::get_platform_library_name(library_name_alternative), + rcpputils::get_platform_library_name(stripped_library_name), + rcpputils::get_platform_library_name(stripped_library_name_alternative) + }; + std::vector all_relative_debug_library_paths = { + rcpputils::get_platform_library_name(library_name, true), + rcpputils::get_platform_library_name(library_name_alternative, true), + rcpputils::get_platform_library_name(stripped_library_name, true), + rcpputils::get_platform_library_name(stripped_library_name_alternative, true) + }; + + for (auto && current_search_path : all_search_paths) { + for (auto && current_library_path : all_relative_library_paths) { + all_paths.push_back(current_search_path + path_separator + current_library_path); + } + for (auto && current_library_path : all_relative_debug_library_paths) { + all_paths.push_back(current_search_path + path_separator + current_library_path); } - } catch (const std::runtime_error & ex) { - throw std::runtime_error{ex.what()}; } for (auto && path : all_paths) {