MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / getFile

Method getFile

lib/vfs/amigaffs.cc:146–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 Bytes getFile(const Path& path) override
147 {
148 AdfMount m(this);
149 if (path.size() == 0)
150 throw BadPathException();
151
152 auto* vol = m.mount();
153 changeDirButOne(vol, path);
154
155 auto* file = adfOpenFile(vol, (char*)path.back().c_str(), (char*)"r");
156 if (!file)
157 throw FileNotFoundException();
158
159 Bytes bytes;
160 ByteWriter bw(bytes);
161 while (!adfEndOfFile(file))
162 {
163 uint8_t buffer[4096];
164 long done = adfReadFile(file, sizeof(buffer), buffer);
165
166 bw += Bytes(buffer, done);
167 }
168
169 adfCloseFile(file);
170 return bytes;
171 }
172
173 void putFile(const Path& path, const Bytes& data) override
174 {

Callers

nothing calls this directly

Calls 9

BadPathExceptionClass · 0.85
adfOpenFileFunction · 0.85
adfEndOfFileFunction · 0.85
adfReadFileFunction · 0.85
adfCloseFileFunction · 0.85
BytesClass · 0.50
sizeMethod · 0.45
mountMethod · 0.45

Tested by

no test coverage detected