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

Function ha_canonical_path

src/cli/hook_augment.c:802–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800}
801
802static bool ha_canonical_path(const char *input, char *output, size_t output_size) {
803 if (!input || !output || output_size == 0U || !cbm_hook_path_is_abs(input)) {
804 return false;
805 }
806 char resolved[4096];
807#ifdef _WIN32
808 const char *source = _fullpath(resolved, input, sizeof(resolved)) ? resolved : input;
809#else
810 const char *source = realpath(input, resolved) ? resolved : input;
811#endif
812 int written = snprintf(output, output_size, "%s", source);
813 if (written < 0 || (size_t)written >= output_size) {
814 return false;
815 }
816 for (char *cursor = output; *cursor; cursor++) {
817 if (*cursor == '\\') {
818 *cursor = '/';
819 }
820 }
821 size_t length = strlen(output);
822 while (length > 1U && output[length - 1U] == '/' && !(length == 3U && output[1] == ':')) {
823 output[--length] = '\0';
824 }
825 return cbm_hook_path_is_abs(output);
826}
827
828static bool ha_path_contains_mode(const char *root, const char *candidate, bool case_insensitive) {
829 if (!root || !candidate) {

Callers 3

ha_resolve_coverageFunction · 0.85

Calls 1

cbm_hook_path_is_absFunction · 0.85

Tested by

no test coverage detected