From f3ebd5c489637c1b75ddc0c62da7d48ce6a6cb37 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Fri, 19 Sep 2025 08:02:25 +0800 Subject: [PATCH] chore: clarify function descriptions and variable names --- component/updater/update_ui.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/component/updater/update_ui.go b/component/updater/update_ui.go index 704d7c47..878adc1b 100644 --- a/component/updater/update_ui.go +++ b/component/updater/update_ui.go @@ -310,14 +310,14 @@ func moveDir(src string, dst string) error { } for _, dirEntry := range dirEntryList { - srcDir := filepath.Join(src, dirEntry.Name()) - dstDir := filepath.Join(dst, dirEntry.Name()) - err = os.Rename(srcDir, dstDir) + srcPath := filepath.Join(src, dirEntry.Name()) + dstPath := filepath.Join(dst, dirEntry.Name()) + err = os.Rename(srcPath, dstPath) if err != nil { // Fallback for invalid cross-device link (errno:18). if errors.Is(err, syscall.Errno(18)) { - err = copyDir(srcDir, dstDir) - _ = os.RemoveAll(srcDir) + err = copyAll(srcPath, dstPath) + _ = os.RemoveAll(srcPath) } } if err != nil { @@ -327,9 +327,9 @@ func moveDir(src string, dst string) error { return nil } -// copyDir copy the src directory to dst +// copyAll copy the src path and any children it contains to dst // modify from [os.CopyFS] -func copyDir(src, dst string) error { +func copyAll(src, dst string) error { return filepath.Walk(src, func(path string, info os.FileInfo, err error) error { if err != nil { return err