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

Function edit_path_split

src/cli/config_edit_path.c:150–163  ·  view source on GitHub ↗

Splits a canonical absolute path into its parent and its final name. */

Source from the content-addressed store, hash-verified

148
149/* Splits a canonical absolute path into its parent and its final name. */
150static int edit_path_split(const char *canonical, char *parent, size_t parent_size, char *base,
151 size_t base_size) {
152 const char *slash = strrchr(canonical, '/');
153 if (!slash || slash[1] == '\0') {
154 return -1;
155 }
156 size_t parent_length = slash == canonical ? 1U : (size_t)(slash - canonical);
157 if (parent_length >= parent_size || edit_path_copy(slash + 1, base, base_size) != 0) {
158 return -1;
159 }
160 memcpy(parent, canonical, parent_length);
161 parent[parent_length] = '\0';
162 return 0;
163}
164
165/* The link's OWN directory must sit under a registered root: that is what
166 * makes the follow an opt-in of the agent-configuration writers rather than

Callers 1

edit_path_classifyFunction · 0.85

Calls 1

edit_path_copyFunction · 0.85

Tested by

no test coverage detected