vfs

package
v1.3.263 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 PreventWrite added in v1.3.219

func PreventWrite(reason string)

PreventWrite prevents further writing to any state.

This is used as a safety mechanism so demo playback cannot have any influence on the system.

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 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