Tool: Polish Pass 1
In sow-tools, extract now behaves like a real sync by default: it overwrites changed extracted files, removes stale extracted files that no longer exist in the built archives, and normalizes extracted resource filenames to lowercase. I also made validation warn on uppercase resource filenames so mixed-case names like I_ELVENCHAIN are surfaced instead of quietly lingering. The extract command output now includes overwritten and removed counts too.
This commit is contained in:
@@ -269,7 +269,7 @@ func resourceFromJSON(path string, moduleHakOrder []string) (erf.Resource, error
|
||||
}
|
||||
|
||||
return erf.Resource{
|
||||
Name: name,
|
||||
Name: strings.ToLower(name),
|
||||
Type: resourceType,
|
||||
Data: buf.Bytes(),
|
||||
}, nil
|
||||
@@ -281,7 +281,7 @@ func pathResource(path string) (erf.Resource, error) {
|
||||
if !ok {
|
||||
return erf.Resource{}, fmt.Errorf("unsupported resource extension %q", filepath.Ext(path))
|
||||
}
|
||||
name := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
|
||||
name := strings.ToLower(strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)))
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return erf.Resource{}, fmt.Errorf("stat %s: %w", path, err)
|
||||
@@ -300,13 +300,13 @@ func rawResource(path string) (erf.Resource, error) {
|
||||
if !ok {
|
||||
return erf.Resource{}, fmt.Errorf("unsupported resource extension %q", filepath.Ext(path))
|
||||
}
|
||||
name := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
|
||||
name := strings.ToLower(strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)))
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return erf.Resource{}, fmt.Errorf("read %s: %w", path, err)
|
||||
}
|
||||
return erf.Resource{
|
||||
Name: name,
|
||||
Name: strings.ToLower(name),
|
||||
Type: resourceType,
|
||||
Data: data,
|
||||
}, nil
|
||||
@@ -322,7 +322,7 @@ func splitSourceName(path string) (string, string, error) {
|
||||
if extension == "" {
|
||||
return "", "", fmt.Errorf("source file must include target resource extension before .json: %s", path)
|
||||
}
|
||||
return strings.TrimSuffix(stem, extension), strings.ToLower(extension), nil
|
||||
return strings.ToLower(strings.TrimSuffix(stem, extension)), strings.ToLower(extension), nil
|
||||
}
|
||||
|
||||
func planHAKChunks(p *project.Project, assets []assetResource) ([]hakChunk, error) {
|
||||
|
||||
Reference in New Issue
Block a user