diff --git a/internal/syncdrive/file_action_task_mgr.go b/internal/syncdrive/file_action_task_mgr.go index a89028e..aa6b84c 100644 --- a/internal/syncdrive/file_action_task_mgr.go +++ b/internal/syncdrive/file_action_task_mgr.go @@ -135,7 +135,8 @@ func (f *FileActionTaskManager) getPanPathFromLocalPath(localPath string) string localRootPath := path.Clean(strings.ReplaceAll(f.task.LocalFolderPath, "\\", "/")) relativePath := strings.TrimPrefix(localPath, localRootPath) - return path.Join(path.Clean(f.task.PanFolderPath), relativePath) + panPath := path.Join(path.Clean(f.task.PanFolderPath), relativePath) + return strings.ReplaceAll(panPath, "\\", "/") } // getLocalPathFromPanPath 通过网盘文件路径获取对应的本地文件的对应路径 @@ -551,6 +552,15 @@ func (f *FileActionTaskManager) fileActionTaskExecutor(ctx context.Context) { if uploadWaitGroup.Parallel() == 0 && downloadWaitGroup.Parallel() == 0 { // 如果也没有进行中的异步任务 f.setExecuteLoopFlag(true) logger.Verboseln("file execute task is finish, exit normally") + prompt := "" + if f.task.Mode == UploadOnly { + prompt = "完成全部文件的同步上传,等待下一次扫描" + } else if f.task.Mode == UploadOnly { + prompt = "完成全部文件的同步下载,等待下一次扫描" + } else { + prompt = "完成全部文件的同步,等待下一次扫描" + } + PromptOutput(prompt) return } } diff --git a/internal/syncdrive/sync_task.go b/internal/syncdrive/sync_task.go index 2fd29b4..3e61efb 100644 --- a/internal/syncdrive/sync_task.go +++ b/internal/syncdrive/sync_task.go @@ -442,6 +442,7 @@ func (t *SyncTask) scanLocalFile(ctx context.Context) { logger.Verboseln("start scan local file process at ", utils.NowTimeStr()) t.SetScanLoopFlag(false) t.fileActionTaskManager.StartFileActionTaskExecutor() + PromptOutput("开始进行文件扫描...") } obj := folderQueue.Pop() @@ -666,6 +667,7 @@ func (t *SyncTask) scanPanFile(ctx context.Context) { logger.Verboseln("start scan pan file process at ", utils.NowTimeStr()) t.SetScanLoopFlag(false) t.fileActionTaskManager.StartFileActionTaskExecutor() + PromptOutput("开始进行文件扫描...") } obj := folderQueue.Pop() if obj == nil { diff --git a/internal/syncdrive/utils.go b/internal/syncdrive/utils.go index 249f1c9..e15f2ba 100644 --- a/internal/syncdrive/utils.go +++ b/internal/syncdrive/utils.go @@ -1,6 +1,8 @@ package syncdrive import ( + "fmt" + "github.com/tickstep/aliyunpan/internal/utils" "io/fs" "os" "path" @@ -33,3 +35,9 @@ func IsSymlinkFile(file fs.FileInfo) bool { } return false } + +func PromptOutput(msg string) { + if LogPrompt { + fmt.Println("[" + utils.NowTimeStr() + "] " + msg) + } +}