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

Function th_mktempdir

tests/test_helpers.h:160–176  ·  view source on GitHub ↗

Create a temporary directory. Returns static buffer with path. * Pattern: prefix is used as part of the dirname. */

Source from the content-addressed store, hash-verified

158/* Create a temporary directory. Returns static buffer with path.
159 * Pattern: prefix is used as part of the dirname. */
160static inline char *th_mktempdir(const char *prefix) {
161 static char buf[256];
162#ifdef _WIN32
163 const char *tmp = getenv("TEMP");
164 if (!tmp)
165 tmp = getenv("TMP");
166 if (!tmp)
167 tmp = "C:\\Temp";
168 snprintf(buf, sizeof(buf), "%s\\%s_XXXXXX", tmp, prefix);
169#else
170 snprintf(buf, sizeof(buf), "/tmp/%s_XXXXXX", prefix);
171#endif
172 if (!cbm_mkdtemp(buf)) {
173 return NULL;
174 }
175 return buf;
176}
177
178/* Runtime IPC validates the complete Windows directory ancestry, so an MSYS2
179 * TEMP rooted under C:/msys64/tmp is intentionally unsuitable even when the

Callers 14

test_git_context.cFile · 0.85
cte_fixtureFunction · 0.85
yaml_fixture_initFunction · 0.85
cte_fixtureFunction · 0.85
ui_delete_fixture_initFunction · 0.85
test_httpd.cFile · 0.85
test_pipeline.cFile · 0.85
test_workspace.cFile · 0.85
test_discover.cFile · 0.85

Calls 1

cbm_mkdtempFunction · 0.85

Tested by

no test coverage detected