(p string)
| 74 | } |
| 75 | |
| 76 | func encodeRepoPath(p string) string { |
| 77 | // Handle empty or invalid input |
| 78 | if p == "" { |
| 79 | return "empty" |
| 80 | } |
| 81 | |
| 82 | vol := filepath.VolumeName(p) |
| 83 | p = p[len(vol):] |
| 84 | |
| 85 | // Trim leading path separators |
| 86 | p = strings.TrimLeft(p, "/\\") |
| 87 | |
| 88 | // Replace separators with - |
| 89 | p = strings.ReplaceAll(p, "/", "-") |
| 90 | p = strings.ReplaceAll(p, "\\", "-") |
| 91 | |
| 92 | // Replace colons (from Windows drive letters) |
| 93 | vol = strings.ReplaceAll(vol, ":", "_") |
| 94 | |
| 95 | // Handle edge case where path was only separators or volume name |
| 96 | result := vol + p |
| 97 | if result == "" { |
| 98 | return "empty" |
| 99 | } |
| 100 | return result |
| 101 | } |
| 102 | |
| 103 | func (jw *jsonlWriter) open() error { |
| 104 | home, err := os.UserHomeDir() |
no outgoing calls