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

Function prepare_config_parent

src/cli/cli.c:7376–7395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7374}
7375
7376static bool prepare_config_parent(const char *path) {
7377 if (!path || !path[0]) {
7378 return false;
7379 }
7380 char parent[CLI_BUF_1K];
7381 int written = snprintf(parent, sizeof(parent), "%s", path);
7382 if (written < 0 || (size_t)written >= sizeof(parent)) {
7383 return false;
7384 }
7385 char *slash = strrchr(parent, '/');
7386 char *backslash = strrchr(parent, '\\');
7387 if (backslash && (!slash || backslash > slash)) {
7388 slash = backslash;
7389 }
7390 if (!slash || slash == parent) {
7391 return slash != NULL;
7392 }
7393 *slash = '\0';
7394 return cbm_mkdir_p(parent, CLI_OCTAL_PERM);
7395}
7396
7397typedef struct {
7398 const char *label;

Calls 1

cbm_mkdir_pFunction · 0.85

Tested by

no test coverage detected