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

Function config_parent_directory

src/ui/config.c:173–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171/* ── Save ────────────────────────────────────────────────────── */
172
173static bool config_parent_directory(const char *path, char *directory, size_t directory_size) {
174 int written = snprintf(directory, directory_size, "%s", path ? path : "");
175 if (written <= 0 || (size_t)written >= directory_size) {
176 return false;
177 }
178 char *slash = strrchr(directory, '/');
179 char *backslash = strrchr(directory, '\\');
180 if (backslash && (!slash || backslash > slash)) {
181 slash = backslash;
182 }
183 if (!slash) {
184 return snprintf(directory, directory_size, ".") == 1;
185 }
186 if (slash == directory) {
187 slash[1] = '\0';
188 } else {
189 *slash = '\0';
190 }
191 return true;
192}
193
194#ifdef _WIN32
195static 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