Skip to content

Commit

Permalink
actual logic
Browse files Browse the repository at this point in the history
  • Loading branch information
LordRusk committed Jan 9, 2021
1 parent 5fb934d commit e49b26e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
fmt.Printf("Could not grab working directory! | %v\n", err)
return
}
Gochan := godesu.New()
Gochan := godesu.New() // intialize godesu

for urlNum, url := range urls { // loop through all urls
purl := strings.Split(url, "/")
Expand All @@ -67,18 +67,18 @@ func main() {
fmt.Printf("Cannot create directory! %v\n", err)
return
}
}

os.Chdir(*customDownloadDir + "/")
os.Chdir(*customDownloadDir + "/")
}
} else {
if err := os.Chdir(purl[3] + "/" + purl[5]); err != nil {
if err := os.MkdirAll(purl[3]+"/"+purl[5], os.ModePerm); err != nil {
fmt.Printf("Cannot create directory! %v\n", err)
return
}
}

os.Chdir(purl[3] + "/" + purl[5])
os.Chdir(purl[3] + "/" + purl[5])
}
}

fmt.Printf("Downloading '%v' %v of %v\n", url, urlNum+1, len(urls))
Expand Down Expand Up @@ -118,6 +118,7 @@ func main() {
finishStateChan <- fs
return
}
defer file.Close()

io.Copy(file, resp.Body)

Expand Down

0 comments on commit e49b26e

Please sign in to comment.