Documentation
¶
Index ¶
- Constants
- func NormalisePath(filePath string) string
- type FileSystem
- 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)
- type Path
Constants ¶
const BasePathMaterial = "materials/"
FilePath prefixes BasePathMaterial is path prefix for all materials/textures
const ExtensionVmt = ".vmt"
File Extensions ExtensionVmt Material file extension
const ExtensionVtf = ".vtf"
ExtensionVtf Texture file extension
Variables ¶
This section is empty.
Functions ¶
func NormalisePath ¶
NormalisePath ensures that the same filepath format is used for paths, regardless of platform.
Types ¶
type FileSystem ¶ added in v0.2.0
type FileSystem struct {
// contains filtered or unexported fields
}
func CreateFilesystemFromGameInfoDefinitions ¶ added in v0.2.0
func CreateFilesystemFromGameInfoDefinitions(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 ¶ added in v0.2.0
func NewFileSystem() *FileSystem
func (*FileSystem) EnumerateResourcePaths ¶ added in v0.2.1
func (fs *FileSystem) EnumerateResourcePaths() []string
EnumerateResourcePaths returns all registered resource paths. Pakfile is excluded.
func (*FileSystem) GetFile ¶ added in v0.2.0
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 ¶ added in v0.2.1
func (fs *FileSystem) PakFile() *lumps.Pakfile
PakFile returns loaded pakfile There can only be 1 registered pakfile at once.
func (*FileSystem) RegisterLocalDirectory ¶ added in v0.2.0
func (fs *FileSystem) RegisterLocalDirectory(directory string)
RegisterLocalDirectory register a filesystem path as a valid asset directory
func (*FileSystem) RegisterPakFile ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (fs *FileSystem) RegisterVpk(path string, vpkFile *vpk.VPK)
RegisterVpk registers a vpk package as a valid asset directory
func (*FileSystem) UnregisterLocalDirectory ¶ added in v0.2.0
func (fs *FileSystem) UnregisterLocalDirectory(directory string)
func (*FileSystem) UnregisterPakFile ¶ added in v0.2.0
func (fs *FileSystem) UnregisterPakFile()
UnregisterPakfile removes the current pakfile from available search locations
func (*FileSystem) UnregisterVpk ¶ added in v0.2.0
func (fs *FileSystem) UnregisterVpk(path string)