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

Function prepare_config_parent

src/cli/cli.c:7165–7184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7163}
7164
7165static bool prepare_config_parent(const char *path) {
7166 if (!path || !path[0]) {
7167 return false;
7168 }
7169 char parent[CLI_BUF_1K];
7170 int written = snprintf(parent, sizeof(parent), "%s", path);
7171 if (written < 0 || (size_t)written >= sizeof(parent)) {
7172 return false;
7173 }
7174 char *slash = strrchr(parent, '/');
7175 char *backslash = strrchr(parent, '\\');
7176 if (backslash && (!slash || backslash > slash)) {
7177 slash = backslash;
7178 }
7179 if (!slash || slash == parent) {
7180 return slash != NULL;
7181 }
7182 *slash = '\0';
7183 return cbm_mkdir_p(parent, CLI_OCTAL_PERM);
7184}
7185
7186typedef struct {
7187 const char *label;

Calls 1

cbm_mkdir_pFunction · 0.85

Tested by

no test coverage detected