From 2e08be587963ac3fcb204fb52186c17254b9fe56 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:29:46 -0700 Subject: Fix more filepaths --- hotline/file_path.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'hotline/file_path.go') diff --git a/hotline/file_path.go b/hotline/file_path.go index c7e1574..460af03 100644 --- a/hotline/file_path.go +++ b/hotline/file_path.go @@ -76,15 +76,6 @@ func (fp *FilePath) Len() uint16 { return binary.BigEndian.Uint16(fp.ItemCount[:]) } -func (fp *FilePath) String() string { - out := []string{"/"} - for _, i := range fp.Items { - out = append(out, string(i.Name)) - } - - return filepath.Join(out...) -} - func readPath(fileRoot string, filePath, fileName []byte) (fullPath string, err error) { var fp FilePath if filePath != nil { @@ -93,9 +84,14 @@ func readPath(fileRoot string, filePath, fileName []byte) (fullPath string, err } } + var subPath string + for _, pathItem := range fp.Items { + subPath = filepath.Join("/", subPath, string(pathItem.Name)) + } + fullPath = filepath.Join( fileRoot, - fp.String(), + subPath, filepath.Join("/", string(fileName)), ) -- cgit