Skip to content

Commit

Permalink
Remove redundant throw of a std::runtime_error (#232)
Browse files Browse the repository at this point in the history
Signed-off-by: Hunter L. Allen <[email protected]>
  • Loading branch information
allenh1 authored Jan 18, 2024
1 parent 1a479c7 commit 1efdb42
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions pluginlib/include/pluginlib/class_loader_imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,31 +393,27 @@ std::vector<std::string> ClassLoader<T>::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<std::string> 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<std::string> 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<std::string> 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<std::string> 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) {
Expand Down

0 comments on commit 1efdb42

Please sign in to comment.