chore(fs): change to a more meaningful function name

pull/10728/head
oscarzhou 12 months ago
parent b93bcd28bd
commit 6739cb427f

@ -938,7 +938,7 @@ func (service *Service) SafeMoveDirectory(originalPath, newPath string) error {
func safeMoveDirectory(src, dst string, copyDirFunc func(string, string, bool) error) error { func safeMoveDirectory(src, dst string, copyDirFunc func(string, string, bool) error) error {
// 1. Backup the source directory to a different folder // 1. Backup the source directory to a different folder
backupDir := fmt.Sprintf("%s-%s", src, "backup") backupDir := fmt.Sprintf("%s-%s", src, "backup")
err := moveDirectoryForUpgrade(src, backupDir) err := moveDirectoryAndOverwrite(src, backupDir)
if err != nil { if err != nil {
return fmt.Errorf("failed to backup source directory: %w", err) return fmt.Errorf("failed to backup source directory: %w", err)
} }
@ -1001,7 +1001,7 @@ func MoveDirectory(originalPath, newPath string) error {
return os.Rename(originalPath, newPath) return os.Rename(originalPath, newPath)
} }
func moveDirectoryForUpgrade(originalPath, newPath string) error { func moveDirectoryAndOverwrite(originalPath, newPath string) error {
if _, err := os.Stat(originalPath); err != nil { if _, err := os.Stat(originalPath); err != nil {
return err return err
} }

Loading…
Cancel
Save