libretro.drivers.vfs.history¶
FileSystemDriver decorator that records the operations performed against another driver.
See also
FileSystemDriverThe protocol this driver implements.
Classes
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
|
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
|
Recorded |
- class HistoryFileSystemDriver[source]¶
Bases:
FileSystemDriverFileSystemDriverthat wraps another and records every call made through it.Each recorded call is appended to
historyas aVfsOperationinstance, making it easy to assert against the exact sequence of VFS operations a core performed.- __init__(interface)[source]¶
Wrap
interfaceand start with an empty history.- Parameters:
interface (
FileSystemDriver) – The underlyingFileSystemDriverto delegate to.- Raises:
TypeError – If
interfaceis not aFileSystemDriver.
- property version¶
Return the VFS interface version implemented by this driver.
- Returns:
The supported VFS interface version (1, 2, or 3).
- get_path(stream)[source]¶
Return the path that was used to open
stream.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().- Return type:
- Returns:
The original path as
bytes, orNoneifstreamis unknown.
See also
retro_vfs_get_path_t()
- open(path, mode, hints)[source]¶
Open the file at
pathand return a handle to it.- Parameters:
mode (
VfsFileAccess) – Access mode flags controlling read/write behavior.hints (
VfsFileAccessHint) – Hints describing the intended access pattern.
- Return type:
- Returns:
A new
retro_vfs_file_handle, orNoneif the file could not be opened.
See also
retro_vfs_open_t()
- close(stream)[source]¶
Close the file referenced by
stream.- Parameters:
stream (
retro_vfs_file_handle) – A file handle previously returned byopen().- Return type:
- Returns:
Trueif the file was closed successfully,Falseotherwise.
See also
retro_vfs_close_t()
- size(stream)[source]¶
Return the size of the file referenced by
stream.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().- Return type:
- Returns:
The size of the file in bytes, or a negative value on failure.
See also
retro_vfs_size_t()
- truncate(stream, length)[source]¶
Truncate (or extend) the file referenced by
streamtolengthbytes.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().length (
int) – The new size of the file, in bytes.
- Return type:
- Returns:
Trueif the operation succeeded,Falseotherwise.
See also
retro_vfs_truncate_t()
- tell(stream)[source]¶
Return the current read/write offset within
stream.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().- Return type:
- Returns:
The current byte offset from the start of the file, or a negative value on failure.
See also
retro_vfs_tell_t()
- seek(stream, offset, whence)[source]¶
Move
stream’s read/write offset tooffsetrelative towhence.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().offset (
int) – The new offset, in bytes, relative towhence.whence (
VfsSeekPosition) – The reference position used to interpretoffset.
- Return type:
- Returns:
The resulting absolute offset, or a negative value on failure.
See also
retro_vfs_seek_t()
- read(stream, buffer)[source]¶
Read bytes from
streamintobuffer.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().buffer (
memoryview[int]) – A writable buffer to receive the bytes that were read.
- Return type:
- Returns:
The number of bytes actually read, or a negative value on failure.
See also
retro_vfs_read_t()
- write(stream, buffer)[source]¶
Write the contents of
buffertostreamat its current offset.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().buffer (
memoryview[int]) – A readable buffer holding the bytes to write.
- Return type:
- Returns:
The number of bytes actually written, or a negative value on failure.
See also
retro_vfs_write_t()
- flush(stream)[source]¶
Flush any buffered data for
streamto the underlying storage.- Parameters:
stream (
retro_vfs_file_handle) – An open file handle previously returned byopen().- Return type:
- Returns:
Trueif the flush succeeded,Falseotherwise.
See also
retro_vfs_flush_t()
- remove(path)[source]¶
Delete the file at
path.- Parameters:
path (
bytes) – Path of the file to remove, encoded asbytes.- Return type:
- Returns:
Trueif the file was removed successfully,Falseotherwise.
See also
retro_vfs_remove_t()
- rename(old_path, new_path)[source]¶
Rename or move the file at
old_pathtonew_path.- Parameters:
- Return type:
- Returns:
Trueif the rename succeeded,Falseotherwise.
See also
retro_vfs_rename_t()
- stat(path)[source]¶
Return file metadata for
path.- Parameters:
path (
bytes) – Path of the entry to inspect, encoded asbytes.- Return type:
- Returns:
A pair of
VfsStatflags and the entry size in bytes, orNoneifpathdoes not exist.
See also
retro_vfs_stat_t()
- mkdir(path)[source]¶
Create a directory at
path.- Parameters:
path (
bytes) – Path of the directory to create, encoded asbytes.- Return type:
- Returns:
A
VfsMkdirResultdescribing the outcome of the operation.
See also
retro_vfs_mkdir_t()
- opendir(path, include_hidden)[source]¶
Open the directory at
pathfor iteration.- Parameters:
- Return type:
- Returns:
A new
retro_vfs_dir_handle, orNoneif the directory could not be opened.
See also
retro_vfs_opendir_t()
- readdir(dir)[source]¶
Advance
dirto its next entry.- Parameters:
dir (
retro_vfs_dir_handle) – An open directory handle previously returned byopendir().- Return type:
- Returns:
Trueif a new entry is now available,Falseif the end was reached.
See also
retro_vfs_readdir_t()
- dirent_get_name(dir)[source]¶
Return the name of the current entry in
dir.- Parameters:
dir (
retro_vfs_dir_handle) – An open directory handle previously returned byopendir().- Return type:
- Returns:
The entry name as
bytes, orNoneif no entry is available.
See also
retro_vfs_dirent_get_name_t()
- dirent_is_dir(dir)[source]¶
Return whether the current entry in
dirrefers to a subdirectory.- Parameters:
dir (
retro_vfs_dir_handle) – An open directory handle previously returned byopendir().- Return type:
- Returns:
Trueif the current entry is a directory,Falseotherwise.
See also
retro_vfs_dirent_is_dir_t()
- closedir(dir)[source]¶
Close
dirand release any associated resources.- Parameters:
dir (
retro_vfs_dir_handle) – A directory handle previously returned byopendir().- Return type:
- Returns:
Trueif the directory was closed successfully,Falseotherwise.
See also
retro_vfs_closedir_t()
- property history¶
The recorded operations in the order they were performed.
- classmethod __new__(*args, **kwargs)¶
- class GetPath[source]¶
Bases:
objectRecorded
FileSystemDriver.get_path()call.- stream¶
- result¶
- __init__(*, stream, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Open[source]¶
Bases:
objectRecorded
FileSystemDriver.open()call.- path¶
- mode¶
- hints¶
- result¶
- __init__(*, path, mode, hints, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Close[source]¶
Bases:
objectRecorded
FileSystemDriver.close()call.- stream¶
- result¶
- __init__(*, stream, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Size[source]¶
Bases:
objectRecorded
FileSystemDriver.size()call.- stream¶
- result¶
- __init__(*, stream, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Truncate[source]¶
Bases:
objectRecorded
FileSystemDriver.truncate()call.- stream¶
- length¶
- result¶
- __init__(*, stream, length, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Tell[source]¶
Bases:
objectRecorded
FileSystemDriver.tell()call.- stream¶
- result¶
- __init__(*, stream, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Seek[source]¶
Bases:
objectRecorded
FileSystemDriver.seek()call.- stream¶
- offset¶
- whence¶
- result¶
- __init__(*, stream, offset, whence, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Read[source]¶
Bases:
objectRecorded
FileSystemDriver.read()call.- stream¶
- buffer¶
- result¶
- __init__(*, stream, buffer, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Write[source]¶
Bases:
objectRecorded
FileSystemDriver.write()call.- stream¶
- buffer¶
- result¶
- __init__(*, stream, buffer, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Flush[source]¶
Bases:
objectRecorded
FileSystemDriver.flush()call.- stream¶
- result¶
- __init__(*, stream, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Remove[source]¶
Bases:
objectRecorded
FileSystemDriver.remove()call.- path¶
- result¶
- __init__(*, path, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Rename[source]¶
Bases:
objectRecorded
FileSystemDriver.rename()call.- old_path¶
- new_path¶
- result¶
- __init__(*, old_path, new_path, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Stat[source]¶
Bases:
objectRecorded
FileSystemDriver.stat()call.- path¶
- result¶
- __init__(*, path, result)¶
- classmethod __new__(*args, **kwargs)¶
- class Mkdir[source]¶
Bases:
objectRecorded
FileSystemDriver.mkdir()call.- path¶
- result¶
- __init__(*, path, result)¶
- classmethod __new__(*args, **kwargs)¶
- class OpenDir[source]¶
Bases:
objectRecorded
FileSystemDriver.opendir()call.- path¶
- result¶
- __init__(*, path, include_hidden, result)¶
- classmethod __new__(*args, **kwargs)¶
- class ReadDir[source]¶
Bases:
objectRecorded
FileSystemDriver.readdir()call.- dir¶
- result¶
- __init__(*, dir, result)¶
- classmethod __new__(*args, **kwargs)¶
- class DirentGetName[source]¶
Bases:
objectRecorded
FileSystemDriver.dirent_get_name()call.- dir¶
- result¶
- __init__(*, dir, result)¶
- classmethod __new__(*args, **kwargs)¶