Skip to content

Commit

Permalink
Ignore non-dirs in buckets dir
Browse files Browse the repository at this point in the history
  • Loading branch information
shilangyu committed Feb 19, 2022
1 parent 5aa9d3b commit c3ef18b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {
bucketsPath := scoopHome() + "\\buckets"

// get specific buckets
buckets, err := ioutil.ReadDir(bucketsPath)
buckets, err := os.ReadDir(bucketsPath)
checkWith(err, "Scoop folder does not exist")

// start workers that will find matching manifests
Expand All @@ -59,8 +59,12 @@ func main() {
var wg sync.WaitGroup

for _, bucket := range buckets {
if !bucket.IsDir() {
continue
}

wg.Add(1)
go func(file os.FileInfo) {
go func(file os.DirEntry) {
// check if $bucketName/bucket exists, if not use $bucketName
bucketPath := bucketsPath + "\\" + file.Name()
if f, err := os.Stat(bucketPath + "\\bucket"); !os.IsNotExist(err) && f.IsDir() {
Expand Down

0 comments on commit c3ef18b

Please sign in to comment.