fix path sperator error in windows OS

This commit is contained in:
tickstep 2024-03-16 23:13:53 +08:00
parent 291fbd54c8
commit 21770fec89
4 changed files with 7 additions and 3 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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 获取本地文件的路径

View File

@ -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 获取本地文件的路径