diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-21 10:29:46 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-21 10:29:46 -0700 |
| commit | 2e08be587963ac3fcb204fb52186c17254b9fe56 (patch) | |
| tree | 6c9f13bda8bfce8777722b1e207c2c9bc9dbe455 /hotline/file_path.go | |
| parent | e00ff8fe2e1b878abfa3d1bfd12449d5f2bb5f59 (diff) | |
Fix more filepaths
Diffstat (limited to 'hotline/file_path.go')
| -rw-r--r-- | hotline/file_path.go | 16 |
1 files changed, 6 insertions, 10 deletions
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)), ) |