Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only append search paths on first PackageNotFound #91

Merged
merged 1 commit into from Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion ament_index_cpp/src/get_package_prefix.cpp
Expand Up @@ -23,11 +23,20 @@
namespace ament_index_cpp
{

static size_t package_not_found_count = 0;

static
std::string
format_package_not_found_error_message(const std::string & package_name)
{
std::string message = "package '" + package_name + "' not found, searching: [";
std::string message = "package '" + package_name + "' not found";

// Don't need to print out the package paths more than once
if (package_not_found_count++ > 0) {
return message;
}

message += ", searching: [";
auto search_paths = get_search_paths();
for (const auto & path : search_paths) {
message += path + ", ";
Expand Down