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