*: cleaner Parent handling
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
3b6cb6e117
commit
a05d8ebbbd
4 changed files with 47 additions and 10 deletions
|
@ -3,6 +3,7 @@ package mtree
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
@ -45,6 +46,13 @@ type Entry struct {
|
|||
Type EntryType
|
||||
}
|
||||
|
||||
func (e Entry) Path() string {
|
||||
if e.Parent == nil {
|
||||
return e.Name
|
||||
}
|
||||
return filepath.Join(e.Parent.Path(), e.Name)
|
||||
}
|
||||
|
||||
func (e Entry) String() string {
|
||||
if e.Raw != "" {
|
||||
return e.Raw
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue