romfs
- RomFS reader
The romfs
module enables reading application read-only filesystems.
RomFSReader objects
- class pyctr.type.romfs.RomFSReader(file, case_insensitive=False, *, fs=None, closefd=None, open_compatibility_mode=True)[source]
Bases:
TypeReaderBase
,FS
Reads 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:
file (FilePathOrObject) – A file path or a file-like object with the RomFS data.
case_insensitive (bool) – Use case-insensitive paths.
closefd (bool) – Close the underlying file object when closed. Defaults to True for file paths, and False for file-like objects.
open_compatibility_mode (bool) – Changes the behavior of
open()
to behave as it did before pyctr 0.8.0. Read its documentation for details.fs (Optional[FS]) –
- open(path, mode='r', buffering=-1, encoding=None, errors=None, newline='', **options)[source]
Open a file for reading.
Warning
By default, for compatibility reasons, this function works differently than the normal FS open method. Files are opened in binary mode by default and
mode
accepts an encoding. This can be toggled off when creating the RomFSReader by passingopen_compatibility_mode=False
. This compatibility layer will be removed in a future release.- Parameters:
path (str) – Path to a file.
buffering (int) – Buffering policy (-1 to use default buffering, 0 to disable buffering, 1 to select line buffering, of any positive integer to indicate a buffer size).
encoding (str) – Encoding for text files (defaults to
utf-8
)errors (Optional[str]) – What to do with unicode decode errors (see
codecs
module for more information).newline (str) – Newline parameter.
- Returns:
A file-like object.
- Return type: