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

Method getFile

lib/vfs/cbmfs.cc:246–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 }
245
246 Bytes getFile(const Path& path) override
247 {
248 if (path.size() != 1)
249 throw BadPathException();
250 Directory dir(this);
251 auto de = dir.findFile(unhex(path[0]));
252 if (de->cbm_type == REL)
253 throw UnimplementedFilesystemException("cannot read .REL files");
254
255 Bytes bytes;
256 ByteWriter bw(bytes);
257
258 uint8_t t = de->start_track - 1;
259 uint8_t s = de->start_sector;
260 for (;;)
261 {
262 auto b = getSector(t, 0, s);
263
264 if (b[0])
265 bw += b.slice(2);
266 else
267 {
268 bw += b.slice(2, b[1]);
269 break;
270 }
271
272 t = b[0] - 1;
273 s = b[1];
274 }
275
276 return bytes;
277 }
278
279private:
280private:

Callers

nothing calls this directly

Calls 6

BadPathExceptionClass · 0.85
unhexFunction · 0.85
sliceMethod · 0.80
sizeMethod · 0.45
findFileMethod · 0.45

Tested by

no test coverage detected