8 const pathSeparator = "/" // File path separator TODO: make configurable to support Windows
10 // FilePathItem represents the file or directory portion of a delimited file path (e.g. foo and bar in "/foo/bar")
13 // 73 75 62 66 6f 6c 64 65 72 // "subfolder"
14 type FilePathItem struct {
19 func NewFilePathItem(b []byte) FilePathItem {
26 type FilePath struct {
31 func (fp *FilePath) UnmarshalBinary(b []byte) error {
35 for i := uint16(0); i < fp.Len(); i++ {
37 fp.Items = append(fp.Items, NewFilePathItem(pathData[:segLen+3]))
38 pathData = pathData[3+segLen:]
44 func (fp *FilePath) Len() uint16 {
45 return binary.BigEndian.Uint16(fp.ItemCount)
48 func (fp *FilePath) String() string {
50 for _, i := range fp.Items {
51 out = append(out, string(i.Name))
53 return strings.Join(out, pathSeparator)
56 func ReadFilePath(filePathFieldData []byte) string {
58 err := fp.UnmarshalBinary(filePathFieldData)