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

Function jl_parent_directory

src/cli/config_json_like.c:1484–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1482}
1483
1484static char *jl_parent_directory(const char *path) {
1485 const char *separator = strrchr(path, '/');
1486#ifdef _WIN32
1487 const char *backslash = strrchr(path, '\\');
1488 if (!separator || (backslash && backslash > separator)) {
1489 separator = backslash;
1490 }
1491#endif
1492 if (!separator) {
1493 return cbm_strdup(".");
1494 }
1495 if (separator == path) {
1496 return cbm_strdup("/");
1497 }
1498 return cbm_strndup(path, (size_t)(separator - path));
1499}
1500
1501static int jl_ensure_parent(const char *path) {
1502 char *parent = jl_parent_directory(path);

Callers 2

jl_ensure_parentFunction · 0.85
jl_sync_parent_directoryFunction · 0.85

Calls 1

cbm_strndupFunction · 0.85

Tested by

no test coverage detected