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

Function prepare_config_parent

src/cli/cli.c:7314–7333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7312}
7313
7314static bool prepare_config_parent(const char *path) {
7315 if (!path || !path[0]) {
7316 return false;
7317 }
7318 char parent[CLI_BUF_1K];
7319 int written = snprintf(parent, sizeof(parent), "%s", path);
7320 if (written < 0 || (size_t)written >= sizeof(parent)) {
7321 return false;
7322 }
7323 char *slash = strrchr(parent, '/');
7324 char *backslash = strrchr(parent, '\\');
7325 if (backslash && (!slash || backslash > slash)) {
7326 slash = backslash;
7327 }
7328 if (!slash || slash == parent) {
7329 return slash != NULL;
7330 }
7331 *slash = '\0';
7332 return cbm_mkdir_p(parent, CLI_OCTAL_PERM);
7333}
7334
7335typedef struct {
7336 const char *label;

Calls 1

cbm_mkdir_pFunction · 0.85

Tested by

no test coverage detected