Create a temporary directory. Returns static buffer with path. * Pattern: prefix is used as part of the dirname. */
| 132 | /* Create a temporary directory. Returns static buffer with path. |
| 133 | * Pattern: prefix is used as part of the dirname. */ |
| 134 | static inline char *th_mktempdir(const char *prefix) { |
| 135 | static char buf[256]; |
| 136 | #ifdef _WIN32 |
| 137 | const char *tmp = getenv("TEMP"); |
| 138 | if (!tmp) tmp = getenv("TMP"); |
| 139 | if (!tmp) tmp = "C:\\Temp"; |
| 140 | snprintf(buf, sizeof(buf), "%s\\%s_XXXXXX", tmp, prefix); |
| 141 | #else |
| 142 | snprintf(buf, sizeof(buf), "/tmp/%s_XXXXXX", prefix); |
| 143 | #endif |
| 144 | if (!cbm_mkdtemp(buf)) { |
| 145 | return NULL; |
| 146 | } |
| 147 | return buf; |
| 148 | } |
| 149 | |
| 150 | /* ── File permissions (no-op on Windows) ──────────────────────── */ |
| 151 |
no test coverage detected