返回 DeepSeek-Reasonix
path_case_platform.go
根目录 / internal / repair / path_case_platform.go
1 //go:build darwin || windows
2
3 package repair
4
5 import (
6 "os"
7 "path/filepath"
8 )
9
10 // existingRepairPathParent returns the closest existing directory that governs
11 // name lookup for path. It also handles create-only targets whose immediate
12 // parent has not been created yet.
13 func existingRepairPathParent(path string) string {
14 dir := filepath.Dir(path)
15 for {
16 if info, err := os.Stat(dir); err == nil && info.IsDir() {
17 return dir
18 }
19 next := filepath.Dir(dir)
20 if next == dir {
21 return ""
22 }
23 dir = next
24 }
25 }
26
26 lines GO