toWslPath converts the referenced URL to a WSL-compatible path if this looks like a Windows absolute path. If no drive is in the URL, defaults to the C drive.
(s string)
| 175 | // |
| 176 | // If no drive is in the URL, defaults to the C drive. |
| 177 | func toWslPath(s string) string { |
| 178 | drive, p, ok := parseUNCPath(s) |
| 179 | if !ok { |
| 180 | return "" |
| 181 | } |
| 182 | return fmt.Sprintf("mnt/%s%s", strings.ToLower(drive), p) |
| 183 | } |
| 184 | |
| 185 | func parseUNCPath(s string) (drive, p string, ok bool) { |
| 186 | // UNC paths use backslashes but we're using forward slashes |
no test coverage detected
searching dependent graphs…