| 221 | } |
| 222 | |
| 223 | path |
| 224 | temp_directory_path() { |
| 225 | /* ISO/IEC 9945 (POSIX): The path supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR. |
| 226 | * If none of these are found, "/tmp" |
| 227 | * */ |
| 228 | for (char const *tp : {"TMPDIR", "TMP", "TEMPDIR"}) { |
| 229 | if (auto v = ::getenv(tp); v) { |
| 230 | return path(v); |
| 231 | } |
| 232 | } |
| 233 | return path("/tmp"); |
| 234 | } |
| 235 | |
| 236 | path |
| 237 | current_path() { |