MCPcopy Create free account
hub / github.com/Snapchat/Valdi / open

Method open

valdi_core/src/valdi_core/cpp/Utils/DiskUtils.cpp:44–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44Result<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
60void FileReader::close() {
61 if (_stream.is_open()) {

Callers

nothing calls this directly

Calls 5

statFromPathFunction · 0.85
ErrorClass · 0.70
openMethod · 0.65
isFileMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected