Add Extract Ignore Lists
This commit is contained in:
@@ -103,8 +103,23 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma
|
||||
overwrittenCount := 0
|
||||
skippedCount := 0
|
||||
|
||||
ignored := make(map[string]bool)
|
||||
for _, ext := range p.Config.Extract.IgnoreExtensions {
|
||||
ignored[ext] = true
|
||||
}
|
||||
|
||||
for _, resource := range archive.Resources {
|
||||
target, data, err := extractedFile(p, resource)
|
||||
ext, ok := erf.ExtensionForResourceType(resource.Type)
|
||||
if !ok {
|
||||
failures = append(failures, fmt.Errorf("unsupported resource type 0x%04X for %s", resource.Type, resource.Name))
|
||||
continue
|
||||
}
|
||||
if ignored[ext] {
|
||||
skippedCount++
|
||||
continue
|
||||
}
|
||||
|
||||
target, data, err := extractedFile(p, resource, ext)
|
||||
if err != nil {
|
||||
failures = append(failures, err)
|
||||
continue
|
||||
@@ -129,11 +144,7 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma
|
||||
return writtenCount, overwrittenCount, skippedCount, failures
|
||||
}
|
||||
|
||||
func extractedFile(p *project.Project, resource erf.Resource) (string, []byte, error) {
|
||||
extension, ok := erf.ExtensionForResourceType(resource.Type)
|
||||
if !ok {
|
||||
return "", nil, fmt.Errorf("unsupported resource type 0x%04X for %s", resource.Type, resource.Name)
|
||||
}
|
||||
func extractedFile(p *project.Project, resource erf.Resource, extension string) (string, []byte, error) {
|
||||
resref := strings.ToLower(resource.Name)
|
||||
|
||||
switch extension {
|
||||
|
||||
@@ -33,6 +33,7 @@ type Config struct {
|
||||
Paths PathConfig `json:"paths"`
|
||||
HAKs []HAKConfig `json:"haks"`
|
||||
TopData TopDataConfig `json:"topdata"`
|
||||
Extract ExtractConfig `json:"extract"`
|
||||
}
|
||||
|
||||
type ModuleConfig struct {
|
||||
@@ -64,6 +65,10 @@ type TopDataConfig struct {
|
||||
Assets string `json:"assets"`
|
||||
}
|
||||
|
||||
type ExtractConfig struct {
|
||||
IgnoreExtensions []string `json:"ignore_extensions"`
|
||||
}
|
||||
|
||||
type Inventory struct {
|
||||
SourceFiles []string
|
||||
ScriptFiles []string
|
||||
|
||||
Reference in New Issue
Block a user