better indexing and classifier

This commit is contained in:
ston1th 2019-05-03 00:05:51 +02:00
commit 98b53d3a33
9 changed files with 168 additions and 32 deletions

View file

@ -25,12 +25,17 @@ type Filesystem struct {
}
func NewFilesystem(base string) (fs *Filesystem, err error) {
if !filepath.IsAbs(base) {
err = errors.New("base dir '" + base + "' is not an absolute path")
return
}
fi, err := os.Stat(base)
if err != nil {
return
}
if !fi.IsDir() {
err = errors.New("base dir '" + base + "' is not a directory")
return
}
fs = &Filesystem{base}
return
@ -68,7 +73,7 @@ func (fs *Filesystem) ReadDir(path string) (d *Directory) {
}
func (fs *Filesystem) Recursive(p string) (paths core.Paths) {
p = Clean(p)
p, _ = filepath.Split(Clean(p))
if len(p) >= 2 {
p = p[:len(p)-1]
}