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:606–616  ·  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

604/* Strip the last path component in place. Returns false at a filesystem or
605 * drive root (nothing left to strip). */
606static bool ha_strip_last_component(char *dir) {
607 char *slash = strrchr(dir, '/');
608 if (!slash || slash == dir) {
609 return false; /* POSIX root "/" */
610 }
611 if (slash == dir + 2 && dir[1] == ':') {
612 return false; /* Windows drive root "X:/" — don't strip to "X:" */
613 }
614 *slash = '\0';
615 return true;
616}
617
618static bool ha_canonical_path(const char *input, char *output, size_t output_size);
619static 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