This commit is contained in:
sentriz
2019-05-19 23:28:05 +01:00
parent 5c657d9630
commit ad571ed7ab
45 changed files with 787 additions and 492 deletions

37
scanner/dir_stack.go Normal file
View File

@@ -0,0 +1,37 @@
package scanner
import (
"github.com/sentriz/gonic/model"
)
type dirStack []*model.Folder
func (s *dirStack) Push(v *model.Folder) {
*s = append(*s, v)
}
func (s *dirStack) Pop() *model.Folder {
l := len(*s)
if l == 0 {
return nil
}
r := (*s)[l-1]
*s = (*s)[:l-1]
return r
}
func (s *dirStack) Peek() *model.Folder {
l := len(*s)
if l == 0 {
return nil
}
return (*s)[l-1]
}
func (s *dirStack) PeekID() int {
l := len(*s)
if l == 0 {
return 0
}
return (*s)[l-1].ID
}