Skip to content

Commit

Permalink
mkdir2
Browse files Browse the repository at this point in the history
  • Loading branch information
orestonce committed Sep 1, 2024
1 parent aa6d3e1 commit 26c4715
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,14 @@ func (this *DownloadEnv) runDownload(req StartDownload_Req, skipInfo SkipTsInfo)
return
}
var err error
if !isDirExists(req.SaveDir) {
err = os.Mkdir(req.SaveDir, os.ModePerm)
if err != nil {
this.setErrMsg("os.Mkdir error1: " + err.Error())
return
}
}
downloadingDir := filepath.Join(req.TsTempDir, "downloading")
if !isDirExists(downloadingDir) {
err = os.Mkdir(downloadingDir, os.ModePerm)
for _, dir := range []string{req.SaveDir, req.TsTempDir, downloadingDir} {
if isDirExists(dir) {
continue
}
err = os.Mkdir(dir, 0755)
if err != nil {
this.setErrMsg("os.Mkdir error2: " + err.Error())
this.setErrMsg("os.Mkdir " + strconv.Quote(dir) + " error: " + err.Error())
return
}
}
Expand Down

0 comments on commit 26c4715

Please sign in to comment.