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

Function config_parent_directory

src/ui/config.c:166–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164/* ── Save ────────────────────────────────────────────────────── */
165
166static bool config_parent_directory(const char *path, char *directory, size_t directory_size) {
167 int written = snprintf(directory, directory_size, "%s", path ? path : "");
168 if (written <= 0 || (size_t)written >= directory_size) {
169 return false;
170 }
171 char *slash = strrchr(directory, '/');
172 char *backslash = strrchr(directory, '\\');
173 if (backslash && (!slash || backslash > slash)) {
174 slash = backslash;
175 }
176 if (!slash) {
177 return snprintf(directory, directory_size, ".") == 1;
178 }
179 if (slash == directory) {
180 slash[1] = '\0';
181 } else {
182 *slash = '\0';
183 }
184 return true;
185}
186
187#ifdef _WIN32
188static volatile LONG g_config_temp_sequence = 0;

Callers 2

cbm_ui_config_saveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected