romfs - RomFS reader
The romfs module enables reading application read-only filesystems.
RomFSReader objects
- class pyctr.type.romfs.RomFSReader(file, case_insensitive=False, *, closefd=None)[source]
Bases:
TypeReaderBaseReads the contents of the RomFS, found inside NCCH containers.
The RomFS found inside an NCCH is wrapped in an IVFC hash-tree container. This class only supports Level 3, which contains the actual files.
- Parameters:
- open(path: str, encoding: str, errors: str | None = None, newline: str | None = None) io.TextIOWrapper[source]
- open(path: str, encoding: None = None, errors: str | None = None, newline: str | None = None) SubsectionIO
Open a file in the RomFS for reading.
The file opens in binary mode by default, unless encoding is specified.
- Parameters:
path – Path to a file within the RomFS.
encoding – The name of the encoding used to decode. Specifying this opens the file in text mode.
errors – The error setting of the decoder.
newline – Controls how newlines are handled in text mode. This is passed to
io.TextIOWrapper.
- Returns:
A
SubsectionIOobject for bytes, orio.TextIOWrapperfor text.- Raises:
RomFSIsADirectoryError – If the item is a directory.
- get_info_from_path(path)[source]
Get a directory or file entry.
- Parameters:
path (str) – Path to a file or directory within the RomFS.
- Returns:
- Raises:
RomFSFileNotFoundError – If the item doesn’t exist.
- Return type:
Union[RomFSDirectoryEntry, RomFSFileEntry]