vfs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Canonical

func Canonical(purpose, name string) string

Canonical returns the canonical name of the given asset. If Canonical returns the same string, Load will load the same asset.

func Init

func Init() error

Init initializes the VFS. Must run after loading the assets.

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