返回 DeepSeek-Reasonix
rename_noreplace_other.go
根目录 / internal / repair / rename_noreplace_other.go
1 //go:build !darwin && !linux && !windows
2
3 package repair
4
5 import "os"
6
7 // Unpackaged ports retain a best-effort existence check. Reasonix's packaged
8 // Linux, macOS, and Windows targets each have an atomic no-replace primitive.
9 func renameRepairNodeNoReplace(oldPath, newPath string) error {
10 if _, err := os.Lstat(newPath); err == nil {
11 return os.ErrExist
12 } else if !os.IsNotExist(err) {
13 return err
14 }
15 return os.Rename(oldPath, newPath)
16 }
17
17 lines GO