fix download save dir error

This commit is contained in:
xiaoyaofenfen 2022-08-26 17:35:20 +08:00
parent 3faf4d3f43
commit 0c80fca74e
3 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ import (
"github.com/tickstep/library-go/logger"
"github.com/urfave/cli"
"os"
"path"
"path/filepath"
"strconv"
"time"
)
@ -385,7 +385,7 @@ func RunShareExport(option, saveFilePath string) {
}
func ExportCsv(savePath string, data [][]string) bool {
folder := path.Dir(savePath)
folder := filepath.Dir(savePath)
if _, err := os.Stat(folder); err != nil {
if !os.IsExist(err) {
os.MkdirAll(folder, os.ModePerm)

View File

@ -128,7 +128,7 @@ func (dtu *DownloadTaskUnit) download() (err error) {
if err != nil && !os.IsExist(err) {
// 本地保存目录不存在,需要创建对应的保存目录
realSaveDirPath := saveDirPathSymlinkFile.RealPath
suffixPath = localfile.GetSuffixPath(path.Dir(dtu.SavePath), saveDirPathSymlinkFile.LogicPath) // 获取后缀不存在的路径
suffixPath = localfile.GetSuffixPath(filepath.Dir(dtu.SavePath), saveDirPathSymlinkFile.LogicPath) // 获取后缀不存在的路径
if suffixPath != "" {
realSaveDirPath = filepath.Join(realSaveDirPath, suffixPath) // 拼接
}

View File

@ -231,7 +231,7 @@ func (f *FileActionTask) downloadFile(ctx context.Context) error {
f.syncFileDb.Update(f.syncItem)
return fmt.Errorf("文件非法,无法下载")
}
localDir := path.Dir(f.syncItem.getLocalFileFullPath())
localDir := filepath.Dir(f.syncItem.getLocalFileFullPath())
if b, e := utils.PathExists(localDir); e == nil && !b {
f.localFolderCreateMutex.Lock()
os.MkdirAll(localDir, 0755)
@ -406,7 +406,7 @@ func (f *FileActionTask) uploadFile(ctx context.Context) error {
}
// 创建文件夹
panDirPath := path.Dir(targetPanFilePath)
panDirPath := filepath.Dir(targetPanFilePath)
panDirFileId := ""
if panDirItem, er := f.panFileDb.Get(panDirPath); er == nil {
if panDirItem != nil && panDirItem.IsFolder() {