# volumes

> **Tool `tools/disc/volumes.py`** (library, Discs and disk images). Find and read the file systems in a CD data track: ISO 9660 with its Joliet names, the older High Sierra format, an El Torito boot record, and an Apple HFS or HFS+ volume (hybrid Mac and PC discs).

A library: other tools and your own scripts import it. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/tools/disc/volumes.py).

## Its own help

This is the help text in the tool itself, as `./gameframe tool volumes` prints it.

```text
Find and read the file systems in a CD data track: ISO 9660 with its Joliet
names, the older High Sierra format, an El Torito boot record, and an Apple HFS or HFS+
volume (hybrid Mac and PC discs).

    from image import open_image
    from volumes import scan
    for vol in scan(open_image('GAME.CUE').tracks[0]): print(vol.kind, vol.info)

ISO 9660 (ECMA-119) keeps its volume descriptors from sector 16 of the session: a primary
descriptor, supplementary ones (Joliet is a supplementary descriptor whose names are UCS-2),
an optional boot record, and a terminator. Numbers are stored twice, little-endian then
big-endian. The directory tree starts at the root record inside each descriptor. HFS keeps
its master directory block 1024 bytes into the volume, so a hybrid disc can carry both. Only
the HFS header is read here: listing an HFS tree needs its B-tree (hfsutils or HFSExplorer).
Standard library only.
```
