Try to not overwrite existing files

This commit is contained in:
Mirror 2021-02-22 22:30:34 +03:00
parent b3ca71d477
commit 70caca9ca0
1 changed files with 17 additions and 12 deletions

View File

@ -51,6 +51,7 @@ func (p *Pixiv) downloadIllust(i Illust) (err error) {
if err != nil {
return err
}
if _, err = os.Stat(file.directory + file.filename); os.IsNotExist(err) {
outfile, err := os.Create(file.directory + file.filename)
if err != nil {
return err
@ -67,6 +68,10 @@ func (p *Pixiv) downloadIllust(i Illust) (err error) {
return err
}
}
} else {
err = nil
continue
}
}
return
}