Documentation ¶
Index ¶
- Constants
- func NormalisePath(filePath string) string
- type FileNotFoundError
- type Filesystem
- func (fs *Filesystem) AllPaths() []string
- func (fs *Filesystem) EnumerateResourcePaths() []string
- func (fs *Filesystem) GetFile(filename string) (io.Reader, error)
- func (fs *Filesystem) PakFile() *lumps.Pakfile
- func (fs *Filesystem) RegisterLocalDirectory(directory string)
- func (fs *Filesystem) RegisterPakFile(pakFile *lumps.Pakfile)
- func (fs *Filesystem) RegisterVpk(path string, vpkFile *vpk.VPK)
- func (fs *Filesystem) UnregisterLocalDirectory(directory string)
- func (fs *Filesystem) UnregisterPakFile()
- func (fs *Filesystem) UnregisterVpk(path string)
Constants ¶
const ( // ExtensionVmt Material file extension ExtensionVmt = ".vmt" // ExtensionVtf Texture file extension ExtensionVtf = ".vtf" )
File Extensions
const ( // BasePathMaterial is path prefix for all materials/textures BasePathMaterial = "materials/" // BasePathModels is path prefix for all models/props BasePathModels = "models/" )
FilePath prefixes
Variables ¶
This section is empty.
Functions ¶
func NormalisePath ¶
NormalisePath ensures that the same filepath format is used for paths, regardless of platform.
Types ¶
type FileNotFoundError ¶
type FileNotFoundError struct {
// contains filtered or unexported fields
}
func NewFileNotFoundError ¶
func NewFileNotFoundError(filename string) *FileNotFoundError
func (FileNotFoundError) Error ¶
func (err FileNotFoundError) Error() string
type Filesystem ¶
type Filesystem struct {
// contains filtered or unexported fields
}
func CreateFromGameDir ¶
func CreateFromGameDir(path string, gameInfo *keyvalues.KeyValue) *Filesystem
func CreateFromGameInfo ¶
func CreateFromGameInfo(basePath string, gameInfo *keyvalues.KeyValue) *Filesystem
CreateFilesystemFromGameInfoDefinitions Reads game resource data paths from gameinfo.txt All games should ship with a gameinfo.txt, but it isn't actually mandatory.
func NewFilesystem ¶
func NewFilesystem() *Filesystem
func (*Filesystem) AllPaths ¶
func (fs *Filesystem) AllPaths() []string
AllPaths returns all the paths (files) that are currently loaded
func (*Filesystem) EnumerateResourcePaths ¶
func (fs *Filesystem) EnumerateResourcePaths() []string
EnumerateResourcePaths returns all registered resource paths. PakFile is excluded.
func (*Filesystem) GetFile ¶
func (fs *Filesystem) GetFile(filename string) (io.Reader, error)
GetFile attempts to get stream for filename. Search order is Pak->FileSystem->VPK
func (*Filesystem) PakFile ¶
func (fs *Filesystem) PakFile() *lumps.Pakfile
PakFile returns loaded pakfile There can only be 1 registered pakfile at once.
func (*Filesystem) RegisterLocalDirectory ¶
func (fs *Filesystem) RegisterLocalDirectory(directory string)
RegisterLocalDirectory register a filesystem path as a valid asset directory
func (*Filesystem) RegisterPakFile ¶
func (fs *Filesystem) RegisterPakFile(pakFile *lumps.Pakfile)
RegisterPakFile Set a pakfile to be used as an asset directory. This would normally be called during each map load
func (*Filesystem) RegisterVpk ¶
func (fs *Filesystem) RegisterVpk(path string, vpkFile *vpk.VPK)
RegisterVpk registers a vpk package as a valid asset directory
func (*Filesystem) UnregisterLocalDirectory ¶
func (fs *Filesystem) UnregisterLocalDirectory(directory string)
func (*Filesystem) UnregisterPakFile ¶
func (fs *Filesystem) UnregisterPakFile()
UnregisterPakFile removes the current pakfile from available search locations
func (*Filesystem) UnregisterVpk ¶
func (fs *Filesystem) UnregisterVpk(path string)