From 17f71578850d342d93dedc6d529ec14b219ff71a Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 26 Dec 2019 01:17:18 +0100 Subject: [PATCH] Add support for locale.scs file Signed-off-by: Knut Ahlers --- scs/scs.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scs/scs.go b/scs/scs.go index b3f7b18..3d8c197 100644 --- a/scs/scs.go +++ b/scs/scs.go @@ -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) }