1
0
mirror of https://github.com/Luzifer/scs-extract.git synced 2024-09-19 15:43:01 +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" "reflect"
"strings" "strings"
"github.com/Luzifer/scs-extract/b0rkhash"
"github.com/pkg/errors" "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 { type CatalogEntry struct {
HashedPath uint64 HashedPath uint64
@ -123,6 +127,11 @@ func (r *Reader) populateFileNames() error {
for _, e := range r.Files { for _, e := range r.Files {
if e.HashedPath == rootPathHash { if e.HashedPath == rootPathHash {
entry = e entry = e
entry.Name = ""
break
} else if e.HashedPath == localeRootPathHash {
entry = e
entry.Name = "locale"
break break
} }
} }
@ -136,8 +145,6 @@ func (r *Reader) populateFileNames() error {
return errors.New("No root path entry found or root path empty") return errors.New("No root path entry found or root path empty")
} }
entry.Name = ""
return r.populateFileTree(entry) return r.populateFileTree(entry)
} }