mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
fix path sperator error in windows OS
This commit is contained in:
parent
291fbd54c8
commit
21770fec89
@ -444,6 +444,7 @@ func (f *FileActionTask) uploadFile(ctx context.Context) error {
|
||||
// 尝试创建文件夹
|
||||
panDirPath := filepath.Dir(targetPanFilePath)
|
||||
panDirFileId := ""
|
||||
logger.Verbosef("检测云盘文件夹: %s\n", panDirPath)
|
||||
if dirFile, er2 := f.panClient.OpenapiPanClient().FileInfoByPath(f.syncItem.DriveId, panDirPath); er2 != nil {
|
||||
if er2.Code == apierror.ApiCodeFileNotFoundCode {
|
||||
logger.Verbosef("创建云盘文件夹: %s\n", panDirPath)
|
||||
@ -456,7 +457,7 @@ func (f *FileActionTask) uploadFile(ctx context.Context) error {
|
||||
panDirFileId = rs.FileId
|
||||
logger.Verbosef("创建云盘文件夹成功: %s\n", panDirPath)
|
||||
} else {
|
||||
logger.Verbosef("创建云盘文件夹错误: %s\n", er2.String())
|
||||
logger.Verbosef("查询云盘文件夹错误: %s\n", er2.String())
|
||||
return er2
|
||||
}
|
||||
} else {
|
||||
|
@ -494,6 +494,7 @@ func (f *FileActionTaskManager) fileActionTaskExecutor(ctx context.Context) {
|
||||
// cancel routine & done
|
||||
logger.Verboseln("file executor routine done")
|
||||
downloadWaitGroup.Wait()
|
||||
uploadWaitGroup.Wait()
|
||||
return
|
||||
default:
|
||||
actionIsEmptyOfThisTerm := true
|
||||
|
@ -348,7 +348,8 @@ func (item *SyncFileItem) getPanFileFullPath() string {
|
||||
localRootPath := strings.ReplaceAll(item.LocalFolderPath, "\\", "/")
|
||||
|
||||
relativePath := strings.TrimPrefix(localPath, localRootPath)
|
||||
return path.Join(path.Clean(item.PanFolderPath), relativePath)
|
||||
panPath := path.Join(path.Clean(item.PanFolderPath), relativePath)
|
||||
return strings.ReplaceAll(panPath, "\\", "/")
|
||||
}
|
||||
|
||||
// getLocalFullPath 获取本地文件的路径
|
||||
|
@ -13,7 +13,8 @@ func GetPanFileFullPathFromLocalPath(localFilePath, localRootPath, panRootPath s
|
||||
localRootPath = strings.ReplaceAll(localRootPath, "\\", "/")
|
||||
|
||||
relativePath := strings.TrimPrefix(localFilePath, localRootPath)
|
||||
return path.Join(path.Clean(panRootPath), relativePath)
|
||||
panPath := path.Join(path.Clean(panRootPath), relativePath)
|
||||
return strings.ReplaceAll(panPath, "\\", "/")
|
||||
}
|
||||
|
||||
// GetLocalFileFullPathFromPanPath 获取本地文件的路径
|
||||
|
Loading…
Reference in New Issue
Block a user