filesystem

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package filesystem provides a filesystem Asset and Source implementation for d2loader

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnAddSource

func OnAddSource(path string) (asset.Source, error)

OnAddSource is a shim method to allow loading of filesystem sources

Types

type Asset

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

Asset represents an asset that is in the host filesystem

func (*Asset) Close

func (fsa *Asset) Close() error

Close closes the file

func (*Asset) Data

func (fsa *Asset) Data() ([]byte, error)

Data returns the raw file data as a slice of bytes

func (*Asset) Path

func (fsa *Asset) Path() string

Path returns the sub-path (within the asset source Root) for this asset

func (*Asset) Read

func (fsa *Asset) Read(p []byte) (n int, err error)

Read reads bytes into the given byte buffer

func (*Asset) Seek

func (fsa *Asset) Seek(offset int64, whence int) (int64, error)

Seek seeks within the file

func (*Asset) Source

func (fsa *Asset) Source() asset.Source

Source returns the asset source that this asset was loaded from

func (*Asset) String

func (fsa *Asset) String() string

String returns the path

func (*Asset) Type

func (fsa *Asset) Type() types.AssetType

Type returns the asset type

type Source

type Source struct {
	Root string
}

Source represents an asset source which is a normal directory on the host file system

func (*Source) Exists

func (s *Source) Exists(subPath string) bool

Exists returns true if the file exists

func (*Source) Open

func (s *Source) Open(subPath string) (io.ReadSeeker, error)

Open opens a file with the given sub-path within the Root dir of the file system source

func (*Source) Path

func (s *Source) Path() string

Path returns the Root dir of this file system source

func (*Source) String

func (s *Source) String() string

String returns the path

func (*Source) Type

func (s *Source) Type() types.SourceType

Type returns the type of this asset source

Jump to

Keyboard shortcuts

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