1
0
Fork 0
mirror of https://github.com/Luzifer/scs-extract.git synced 2024-12-20 13:31:16 +00:00

Add support for locale.scs file

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-12-26 01:17:18 +01:00
parent 71fc401a28
commit 17f7157885
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -11,11 +11,15 @@ import (
"reflect"
"strings"
"github.com/Luzifer/scs-extract/b0rkhash"
"github.com/pkg/errors"
"github.com/Luzifer/scs-extract/b0rkhash"
)
var rootPathHash = b0rkhash.CityHash64([]byte(""))
var (
localeRootPathHash = b0rkhash.CityHash64([]byte("locale"))
rootPathHash = b0rkhash.CityHash64([]byte(""))
)
type CatalogEntry struct {
HashedPath uint64
@ -123,6 +127,11 @@ func (r *Reader) populateFileNames() error {
for _, e := range r.Files {
if e.HashedPath == rootPathHash {
entry = e
entry.Name = ""
break
} else if e.HashedPath == localeRootPathHash {
entry = e
entry.Name = "locale"
break
}
}
@ -136,8 +145,6 @@ func (r *Reader) populateFileNames() error {
return errors.New("No root path entry found or root path empty")
}
entry.Name = ""
return r.populateFileTree(entry)
}