Add Extract Ignore Lists

This commit is contained in:
2026-04-21 19:10:29 +02:00
parent b690135057
commit 2c2dce7e41
3 changed files with 22 additions and 6 deletions
+17 -6
View File
@@ -103,8 +103,23 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma
overwrittenCount := 0 overwrittenCount := 0
skippedCount := 0 skippedCount := 0
ignored := make(map[string]bool)
for _, ext := range p.Config.Extract.IgnoreExtensions {
ignored[ext] = true
}
for _, resource := range archive.Resources { 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 { if err != nil {
failures = append(failures, err) failures = append(failures, err)
continue continue
@@ -129,11 +144,7 @@ func extractArchiveResources(p *project.Project, archive erf.Archive, desired ma
return writtenCount, overwrittenCount, skippedCount, failures return writtenCount, overwrittenCount, skippedCount, failures
} }
func extractedFile(p *project.Project, resource erf.Resource) (string, []byte, error) { func extractedFile(p *project.Project, resource erf.Resource, extension string) (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)
}
resref := strings.ToLower(resource.Name) resref := strings.ToLower(resource.Name)
switch extension { switch extension {
+5
View File
@@ -33,6 +33,7 @@ type Config struct {
Paths PathConfig `json:"paths"` Paths PathConfig `json:"paths"`
HAKs []HAKConfig `json:"haks"` HAKs []HAKConfig `json:"haks"`
TopData TopDataConfig `json:"topdata"` TopData TopDataConfig `json:"topdata"`
Extract ExtractConfig `json:"extract"`
} }
type ModuleConfig struct { type ModuleConfig struct {
@@ -64,6 +65,10 @@ type TopDataConfig struct {
Assets string `json:"assets"` Assets string `json:"assets"`
} }
type ExtractConfig struct {
IgnoreExtensions []string `json:"ignore_extensions"`
}
type Inventory struct { type Inventory struct {
SourceFiles []string SourceFiles []string
ScriptFiles []string ScriptFiles []string
BIN
View File
Binary file not shown.