38 lines
906 B
Go
38 lines
906 B
Go
package sqan
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"errors"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
type File struct {
|
||
|
|
RootDir string `json:"rootDir,omitempty"`
|
||
|
|
AbsolutePath string `json:"absolutePath,omitempty"`
|
||
|
|
RelativeDir string `json:"relativeDir,omitempty"`
|
||
|
|
RelativePath string `json:"relativePath,omitempty"`
|
||
|
|
Filename string `json:"filename,omitempty"`
|
||
|
|
Extension string `json:"extension,omitempty"`
|
||
|
|
Hash string `json:"hash,omitempty"`
|
||
|
|
Size int64 `json:"size,omitempty"`
|
||
|
|
Modified time.Time `json:"modified,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (f *File) Process() error {
|
||
|
|
return errors.New("unimplemented")
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewFile(rootDir, absPath string) *File {
|
||
|
|
relPath, relDir, filename, extension := ParsePath(rootDir, absPath)
|
||
|
|
|
||
|
|
f := &File{
|
||
|
|
RootDir: rootDir,
|
||
|
|
AbsolutePath: absPath,
|
||
|
|
RelativeDir: relDir,
|
||
|
|
RelativePath: relPath,
|
||
|
|
Filename: filename,
|
||
|
|
Extension: extension,
|
||
|
|
}
|
||
|
|
|
||
|
|
return f
|
||
|
|
}
|