| 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 | |
| 279 | private: |
| 280 | private: |
nothing calls this directly
no test coverage detected