mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-02-02 21:27:15 +08:00
fix download save dir error
This commit is contained in:
parent
3faf4d3f43
commit
0c80fca74e
@ -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)
|
||||
|
@ -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) // 拼接
|
||||
}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user