Documentation ¶
Overview ¶
Package vpkutil provides useful helpers for manipulating VPK files.
Index ¶
- Constants
- type CLIIncludeExclude
- type CLIResolveOpen
- type VPKFlags
- func (v *VPKFlags) Add(glob string, loadFlags uint32, textureFlags uint16) error
- func (v *VPKFlags) Generate(root tf2vpk.ValvePakDir) error
- func (v *VPKFlags) GenerateExplicit(root tf2vpk.ValvePakDir) error
- func (v VPKFlags) Match(path string) (loadFlags uint32, textureFlags uint16)
- func (v *VPKFlags) Parse(s string) error
- func (v *VPKFlags) ParseFile(name string) error
- func (v VPKFlags) String() string
- func (v VPKFlags) Test(root tf2vpk.ValvePakDir) error
- type VPKIgnore
- func (v *VPKIgnore) Add(glob string, negate bool) error
- func (v *VPKIgnore) AddAutoExclusions(root tf2vpk.ValvePakDir) error
- func (v *VPKIgnore) AddDefault()
- func (v VPKIgnore) Match(path string) bool
- func (v *VPKIgnore) Parse(s string) error
- func (v *VPKIgnore) ParseFile(name string) error
- func (v VPKIgnore) String() string
Constants ¶
const VPKFlagsFilename = ".vpkflags"
VPKFlagsFilename is the name of the vpkflags file. It should be at the root of the folder to be packed.
const VPKIgnoreFilename = ".vpkignore"
VPKIgnoreFilename is the name of the vpkignore file. It should be at the root of the folder to be packed.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIIncludeExclude ¶ added in v0.0.4
CLIIncludeExclude filters VPK files using the provided globs.
func NewCLIIncludeExclude ¶ added in v0.0.4
func NewCLIIncludeExclude(set *pflag.FlagSet) CLIIncludeExclude
NewCLIIncludeExclude creates a new CLIIncludeExclude and registers it with the provided pflag.FlagSet.
func (CLIIncludeExclude) Skip ¶ added in v0.0.4
func (ie CLIIncludeExclude) Skip(f tf2vpk.ValvePakFile) (bool, error)
Skip determines whether to skip the specified file.
type CLIResolveOpen ¶ added in v0.0.4
type CLIResolveOpen struct { Arg int Optional bool VPKPrefix *string // contains filtered or unexported fields }
CLIResolveOpen takes over the last 1 or 2 arguments, using them to resolve and open a VPK.
func NewCLIResolveOpen ¶ added in v0.0.4
func NewCLIResolveOpen(set *pflag.FlagSet, arg int, optional bool) CLIResolveOpen
NewCLIResolveOpen creates a new CLIResolveOpen and registers it with the provided pflag.FlagSet. It starts processing arguments at the provided index (where 0 is the first argument after flags have been parsed).
func (CLIResolveOpen) ArgCheck ¶ added in v0.0.4
func (ro CLIResolveOpen) ArgCheck() bool
ArgCheck ensures at 1-2 (or 0-2 if optional) arguments are provided at the specified argument index.
func (CLIResolveOpen) ArgHelp ¶ added in v0.0.4
func (ro CLIResolveOpen) ArgHelp() string
ArgHelp returns help text to add to the arguments usage.
func (CLIResolveOpen) Resolve ¶ added in v0.0.4
func (ro CLIResolveOpen) Resolve() (vpk tf2vpk.ValvePak, err error)
Resolve resolves the VPK path.
func (CLIResolveOpen) ResolveOpen ¶ added in v0.0.4
ResolveOpen resolves the VPK path and opens a reader.
type VPKFlags ¶
type VPKFlags struct {
// contains filtered or unexported fields
}
VPKFlags is a list of rules for adding flags to files in a VPK. The rules are matched in reverse order, i.e., the last one takes effect.
func (*VPKFlags) Generate ¶
func (v *VPKFlags) Generate(root tf2vpk.ValvePakDir) error
Generate generates a new minimal VPKFlags (through inheriting from parent dirs) based on the provided VPK, replacing any existing rules.
func (*VPKFlags) GenerateExplicit ¶
func (v *VPKFlags) GenerateExplicit(root tf2vpk.ValvePakDir) error
GenerateExplicit generates a new VPKFlags based on the provided VPK with all files explicitly set, replacing any existing rules.
type VPKIgnore ¶
type VPKIgnore struct {
// contains filtered or unexported fields
}
VPKIgnore is a list of patterns to ignore when packing a VPK file in a similar fashion to gitignore.
Each pattern consists of a case-sensitive glob (same as with VPKFlags), optionally negated (denoted by a exclamation mark prefix in string form).
The rules are checked from top to bottom. If a rule is matched, the file is tentatively excluded unless matched by a negated rule afterwards (a matched negated rule before a match does nothing). If matched by a negated rule, the file is not excluded, and no further rules for that file are processed.
func (*VPKIgnore) AddAutoExclusions ¶
func (v *VPKIgnore) AddAutoExclusions(root tf2vpk.ValvePakDir) error
AddAutoExclusions automatically adds negated rules for files in a VPK.