| 381 | } |
| 382 | |
| 383 | af_err af_get_kernel_cache_directory(size_t* length, char* path) { |
| 384 | try { |
| 385 | std::string& cache_path = getCacheDirectory(); |
| 386 | if (path == nullptr) { |
| 387 | ARG_ASSERT(length != nullptr, 1); |
| 388 | *length = cache_path.size(); |
| 389 | } else { |
| 390 | size_t min_len = cache_path.size(); |
| 391 | if (length) { |
| 392 | if (*length < cache_path.size()) { |
| 393 | AF_ERROR("Length not sufficient to store the path", |
| 394 | AF_ERR_SIZE); |
| 395 | } |
| 396 | min_len = std::min(*length, cache_path.size()); |
| 397 | } |
| 398 | memcpy(path, cache_path.c_str(), min_len); |
| 399 | } |
| 400 | } |
| 401 | CATCHALL |
| 402 | return AF_SUCCESS; |
| 403 | } |
| 404 | |
| 405 | af_err af_set_kernel_cache_directory(const char* path, int override_env) { |
| 406 | try { |