X-Git-Url: https://git.r.bdr.sh/rbdr/mobius/blobdiff_plain/f22acf38da970aa0d865a9978c9499dad01d235f..270abe9a991a57084650424a0238ef4f062b0b64:/hotline/file_path.go?ds=sidebyside diff --git a/hotline/file_path.go b/hotline/file_path.go index c8fe652..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,10 +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)), )