Skip to content

Commit

Permalink
Split the last hyphen to retrieve the correct component name
Browse files Browse the repository at this point in the history
  • Loading branch information
felicityzhao9 committed Dec 11, 2024
1 parent 41fa182 commit d33664a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ggdeploymentd/src/component_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ GglError iterate_over_components(
GglBuffer entry_buf = ggl_buffer_from_null_term((*entry)->d_name);
// recipe file names follow this format:
// <component_name>-<version>.<extension>
// Split directory entry on the index of the "-" character.
// Split the last "-" character to retrieve the component name
GglBuffer recipe_component;
GglBuffer rest = GGL_STR("");
for (size_t i = 0; i < entry_buf.len; ++i) {
for (size_t i = entry_buf.len; i-- > 0;) {
if (entry_buf.data[i] == '-') {
recipe_component = ggl_buffer_substr(entry_buf, 0, i);
rest = ggl_buffer_substr(entry_buf, i + 1, SIZE_MAX);
Expand Down

0 comments on commit d33664a

Please sign in to comment.