"encoding/binary"
"errors"
"path"
+ "strings"
)
const pathSeparator = "/" // File path separator TODO: make configurable to support Windows
}
const minFilePathLen = 2
+
func (fp *FilePath) UnmarshalBinary(b []byte) error {
if b == nil {
return nil
return nil
}
+func (fp *FilePath) IsDropbox() bool {
+ if fp.Len() == 0 {
+ return false
+ }
+
+ return strings.Contains(strings.ToLower(string(fp.Items[fp.Len()-1].Name)), "drop box")
+}
+
+func (fp *FilePath) IsUploadDir() bool {
+ if fp.Len() == 0 {
+ return false
+ }
+
+ return strings.Contains(strings.ToLower(string(fp.Items[fp.Len()-1].Name)), "upload")
+}
+
func (fp *FilePath) Len() uint16 {
return binary.BigEndian.Uint16(fp.ItemCount[:])
}