get num of bytes
| 11 | namespace rabitqlib { |
| 12 | // get num of bytes |
| 13 | inline size_t get_filesize(const char* filename) noexcept { |
| 14 | try { |
| 15 | return std::filesystem::file_size(filename); |
| 16 | } catch (const std::filesystem::filesystem_error& e) { |
| 17 | // Log the error and return -1 to maintain original behavior on error. |
| 18 | std::cerr << "Error getting file size for '" << filename << "': " << e.what() |
| 19 | << '\n'; |
| 20 | return static_cast<size_t>(-1); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | inline bool file_exists(const char* filename) { return std::filesystem::exists(filename); } |
| 25 |