vfs

package
v1.5.129 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrashOnWrite added in v1.4.72

func CrashOnWrite(reason string)

CrashOnWrite prevents further writing to any state.

This is used as a safety mechanism so demo playback cannot have any influence on the system, and to ensure that demo playback's write attempts are properly redirected to memory buffers for regression testing.

func Init

func Init() error

Init initializes the VFS. Must be called before loading anything.

func MoveAwayState

func MoveAwayState(kind StateKind, name string) error

MoveAwayState renames a detected-to-be-broken state file so it will not be used again.

func OSCreate added in v1.3.436

func OSCreate(root OSRoot, name string) (writeFile, error)

func OSOpen added in v1.3.436

func OSOpen(root OSRoot, name string) (readFile, error)

func ReadDir

func ReadDir(purpose string) ([]string, error)

ReadDir lists all files in a directory. Returns their VFS paths!

func ReadState

func ReadState(kind StateKind, name string) ([]byte, error)

ReadState loads the given state file and returns its contents.

func SetFilesDir added in v1.2.229

func SetFilesDir(dir string)

SetFilesDir does nothing (on Android it'd be used to notify the Go code where to store its data).

func WriteState

func WriteState(kind StateKind, name string, data []byte) error

WriteState writes the given state file.

Types

type OSRoot added in v1.5.6

type OSRoot int
const (
	WorkDir OSRoot = iota
	ExeDir
)

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

ReadSeekCloser is a typical file interface.

func Load

func Load(purpose, name string) (ReadSeekCloser, error)

func LoadPath added in v1.2.4

func LoadPath(purpose, name string) (ReadSeekCloser, error)

type StateKind

type StateKind int
const (
	Config StateKind = iota
	SavedGames
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL