| 61 | } |
| 62 | |
| 63 | std::optional<std::string> generateTempFolderPath( |
| 64 | const char* basePath, |
| 65 | const char* prefix) { |
| 66 | auto path = fmt::format("{}/bolt_{}_XXXXXX", basePath, prefix); |
| 67 | auto createdPath = mkdtemp(path.data()); |
| 68 | if (createdPath == nullptr) { |
| 69 | return std::nullopt; |
| 70 | } |
| 71 | return path; |
| 72 | } |
| 73 | |
| 74 | } // namespace bytedance::bolt::common |