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

Function cv_write

tests/test_conditional_variants.c:53–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51} cv_proj_t;
52
53static bool cv_write(const char *root, const cv_file_t *file) {
54 char path[700];
55 snprintf(path, sizeof(path), "%s/%s", root, file->name);
56 char *slash = strrchr(path, '/');
57 if (slash && slash > path + strlen(root)) {
58 *slash = '\0';
59 cbm_mkdir_p(path, 0755);
60 *slash = '/';
61 }
62 FILE *f = cbm_fopen(path, "wb");
63 if (!f) {
64 return false;
65 }
66 bool ok = fputs(file->content, f) >= 0;
67 return fclose(f) == 0 && ok;
68}
69
70static bool cv_index(cv_proj_t *p, const cv_file_t *files, int count) {
71 memset(p, 0, sizeof(*p));

Callers 3

cv_indexFunction · 0.85
cv_edit_matches_fullFunction · 0.85
cv_incremental_baseFunction · 0.85

Calls 2

cbm_mkdir_pFunction · 0.85
cbm_fopenFunction · 0.85

Tested by

no test coverage detected