@@ -20,6 +20,41 @@ index a72a85b..8b69dda 100644
2020 endif()
2121
2222 find_program(GIT_SCM git DOC "Git version control")
23+ diff --git a/src/message_definition_cache.cpp b/src/message_definition_cache.cpp
24+ index f338db9..d766894 100644
25+ --- a/src/message_definition_cache.cpp
26+ +++ b/src/message_definition_cache.cpp
27+ @@ -225,16 +225,16 @@ const MessageSpec& MessageDefinitionCache::load_message_spec(
28+
29+ // Find the first line that ends with the filename we're looking for
30+ const auto lines = split_string(index_contents);
31+ - const auto it = std::find_if(lines.begin(), lines.end(), [&filename](const std::string& line) {
32+ + const auto line_it = std::find_if(lines.begin(), lines.end(), [&filename](const std::string& line) {
33+ std::filesystem::path filePath(line);
34+ return filePath.filename() == filename;
35+ });
36+ - if (it == lines.end()) {
37+ + if (line_it == lines.end()) {
38+ throw DefinitionNotFoundError(definition_identifier.package_resource_name);
39+ }
40+
41+ // Read the file
42+ - const std::string full_path = share_dir + std::filesystem::path::preferred_separator + *it;
43+ + const std::filesystem::path full_path = std::filesystem::path(share_dir) / *line_it;
44+ std::ifstream file{full_path};
45+ if (!file.good()) {
46+ throw DefinitionNotFoundError(definition_identifier.package_resource_name);
47+ @@ -376,8 +376,8 @@ std::pair<MessageDefinitionFormat, const std::string&> MessageDefinitionCache::g
48+ result = delimiter(root_definition_identifier) + append_recursive(root_definition_identifier);
49+ }
50+
51+ - auto [it, _] = full_text_cache_.emplace(root_package_resource_name, result);
52+ - return {format, it->second};
53+ + auto [cache_it, _] = full_text_cache_.emplace(root_package_resource_name, result);
54+ + return {format, cache_it->second};
55+ }
56+
57+ } // namespace foxglove_bridge
2358diff --git a/src/ros2_foxglove_bridge.cpp b/src/ros2_foxglove_bridge.cpp
2459index 978c732..83dce52 100644
2560--- a/src/ros2_foxglove_bridge.cpp
0 commit comments