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

Function sp_write

tests/test_spawns.c:163–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161} sp_proj_t;
162
163static bool sp_write(const char *root, const char *name, const char *content) {
164 char path[700];
165 snprintf(path, sizeof(path), "%s/%s", root, name);
166 char *slash = strrchr(path, '/');
167 if (slash && slash > path + strlen(root)) {
168 *slash = '\0';
169 cbm_mkdir_p(path, 0755);
170 *slash = '/';
171 }
172 FILE *f = cbm_fopen(path, "wb");
173 if (!f) {
174 return false;
175 }
176 bool ok = fputs(content, f) >= 0;
177 return fclose(f) == 0 && ok;
178}
179
180/* Index `files`, plus `pad` trivial Python files (enough of them moves the
181 * index onto the parallel resolver, MIN_FILES_FOR_PARALLEL). */

Callers 1

sp_indexFunction · 0.85

Calls 2

cbm_mkdir_pFunction · 0.85
cbm_fopenFunction · 0.85

Tested by

no test coverage detected