Simplified file structure
This commit is contained in:
parent
cacee7260a
commit
a466281307
219 changed files with 453 additions and 457 deletions
30
src/scanner/queueDirectory.go
Normal file
30
src/scanner/queueDirectory.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package scanner
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/fs"
|
||||
)
|
||||
|
||||
// queueDirectory queues an entire directory to be scanned.
|
||||
func (s *Scanner) queueDirectory(directory string, pkg string) {
|
||||
_, loaded := s.queued.LoadOrStore(directory, nil)
|
||||
|
||||
if loaded {
|
||||
return
|
||||
}
|
||||
|
||||
err := fs.Walk(directory, func(name string) {
|
||||
if !strings.HasSuffix(name, ".q") {
|
||||
return
|
||||
}
|
||||
|
||||
fullPath := filepath.Join(directory, name)
|
||||
s.queueFile(fullPath, pkg)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
s.errors <- err
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue