MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ha_strip_last_component

Function ha_strip_last_component

src/cli/hook_augment.c:530–540  ·  view source on GitHub ↗

Strip the last path component in place. Returns false at a filesystem or * drive root (nothing left to strip). */

Source from the content-addressed store, hash-verified

528/* Strip the last path component in place. Returns false at a filesystem or
529 * drive root (nothing left to strip). */
530static bool ha_strip_last_component(char *dir) {
531 char *slash = strrchr(dir, '/');
532 if (!slash || slash == dir) {
533 return false; /* POSIX root "/" */
534 }
535 if (slash == dir + 2 && dir[1] == ':') {
536 return false; /* Windows drive root "X:/" — don't strip to "X:" */
537 }
538 *slash = '\0';
539 return true;
540}
541
542static bool ha_canonical_path(const char *input, char *output, size_t output_size);
543static bool ha_path_contains(const char *root, const char *candidate);

Callers 2

ha_resolve_coverageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected