| 42 | } |
| 43 | |
| 44 | Result<FileStat> FileReader::open() { |
| 45 | auto stat = statFromPath(_path.c_str()); |
| 46 | |
| 47 | if (!stat.isFile()) { |
| 48 | return Error(STRING_FORMAT("No file at {}", _path)); |
| 49 | } |
| 50 | |
| 51 | _stream.open(_path, std::ios::binary); |
| 52 | if (!_stream.is_open()) { |
| 53 | return Error(STRING_FORMAT("Unable to open file at {}", _path)); |
| 54 | } |
| 55 | |
| 56 | _fileSize = stat.size(); |
| 57 | return stat; |
| 58 | } |
| 59 | |
| 60 | void FileReader::close() { |
| 61 | if (_stream.is_open()) { |
nothing calls this directly
no test coverage detected