20inline bool checkDiskSpace(
const fs::path& path, uint64_t required_space_MB) {
23 if (!fs::exists(path) && !fs::create_directories(path, ec)) {
24 std::cerr <<
"Error creating directory " << path <<
": " << ec.message() << std::endl;
28 fs::space_info spaceInfo = fs::space(path);
31 uint64_t required_space_bytes = required_space_MB * 1024 * 1024;
34 return spaceInfo.available >= required_space_bytes;
35 }
catch (
const fs::filesystem_error& e) {
37 std::cerr <<
"Filesystem error: " << e.what() << std::endl;