bfs

package
v14.14.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BustGhosts

func BustGhosts(params *BustGhostsParams) error

*

  • A ghost busting is performed after performing an install using a method
  • that lets us know exactly what was written to disk. *
  • In this case, we:
  • - Install in-place, directly into the destination
  • - Compare the previous list of installed files with the list
  • of files we just wrote to disk
  • - Remove all the ghosts *
  • Ghosts are files that were in the previous install and aren't present
  • in the new install. Since we don't want to keep old, unnecessary files
  • (that aren't angels) around, we just remove them. *
  • See also: save angels.

func ContainerPaths

func ContainerPaths(container *tlc.Container) []string

ContainerPaths returns a list of all paths in a container, for all files and symlinks. Folders are excluded

func Difference

func Difference(a []string, b []string) []string

Return elements in b that aren't in a

func DotItchFilter

func DotItchFilter() tlc.FilterFunc

func Exists

func Exists(path string) bool

func Mkdir

func Mkdir(path string) error

func ReceiptPath

func ReceiptPath(InstallFolder string) string

func SliceToLength

func SliceToLength(a []string, length int) []string

func StartAsymptoticProgress

func StartAsymptoticProgress(consumer *state.Consumer, cancel chan struct{})

func Walk

func Walk(path string) (*tlc.Container, error)

Types

type BustGhostsParams

type BustGhostsParams struct {
	Consumer *state.Consumer
	Folder   string
	NewFiles []string
	Receipt  *Receipt
}

type DirTree

type DirTree struct {
	// contains filtered or unexported fields
}

func NewDirTree

func NewDirTree(basePath string) *DirTree

func (*DirTree) CommitFiles

func (dt *DirTree) CommitFiles(filePaths []string)

func (*DirTree) EnsureParents

func (dt *DirTree) EnsureParents(filePath string) error

EnsureParents makes sure that all the parent directories of a given path exist

func (*DirTree) ListRelativeDirs

func (dt *DirTree) ListRelativeDirs() []string

ListRelativeDirs returns a list of directories in this tree, relative to the tree's base path, depth first

type Receipt

type Receipt struct {
	// The itch.io game installed at this location
	Game *itchio.Game `json:"game"`
	// The itch.io upload installed at this location
	Upload *itchio.Upload `json:"upload"`
	// The itch.io build installed at this location. Null for non-wharf upload.
	Build *itchio.Build `json:"build"`

	// A list of installed files (slash-separated paths, relative to install folder)
	Files []string `json:"files"`
	// The installer used to install at this location
	// @optional
	InstallerName string `json:"installerName"`

	// If this was installed from an MSI package, the product code,
	// used for a clean uninstall.
	// @optional
	MSIProductCode string `json:"msiProductCode,omitempty"`
}

A Receipt describes what was installed to a specific folder.

It's compressed and written to `./.itch/receipt.json.gz` every time an install operation completes successfully, and is used in further install operations to make sure ghosts are busted and/or angels are saved.

func ReadReceipt

func ReadReceipt(InstallFolder string) (*Receipt, error)

func (*Receipt) HasFiles

func (r *Receipt) HasFiles() bool

func (*Receipt) WriteReceipt

func (r *Receipt) WriteReceipt(InstallFolder string) error

type SaveAngelsFunc

type SaveAngelsFunc func() error

type SaveAngelsParams

type SaveAngelsParams struct {
	Consumer *state.Consumer
	Folder   string
	Receipt  *Receipt
}

type SaveAngelsResult

type SaveAngelsResult struct {
	Files []string
}

func SaveAngels

func SaveAngels(params *SaveAngelsParams, innerTask SaveAngelsFunc) (*SaveAngelsResult, error)

*

  • An angel redemption is performed when we need to run arbitrary installers
  • that do not report which files they wrote. *
  • Conceptually:
  • - We rename the existing folder to a temporary folder
  • - We install to a fresh folder
  • - We merge angels with the fresh folder
  • - We clean up the temporary folder *
  • Angels are files that have been written by the game (like configurations
  • or save files) or the user (by applying a mod manually, for example)
  • They're not part of a fresh installation of the previous version,
  • but we do want to keep them around. *
  • See also: bust ghosts.

type WalkFunc

type WalkFunc func(name string, node dirnode)

Jump to

Keyboard shortcuts

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