func fixNetworkDrivePath()

in providers/windows/device_windows.go [66:91]


func fixNetworkDrivePath(device string) string {
	// For a VirtualBox share:
	// device=\device\vboxminirdr\;z:\vboxsvr\share
	// path=\device\vboxminirdr\vboxsvr\share
	//
	// For a network share:
	// device=\device\lanmanredirector\;q:nnnnnnn\server\share
	// path=\device\mup\server\share

	semicolonPos := strings.IndexByte(device, ';')
	colonPos := strings.IndexByte(device, ':')
	if semicolonPos == -1 || colonPos != semicolonPos+2 {
		return device
	}
	pathStart := strings.IndexByte(device[colonPos+1:], '\\')
	if pathStart == -1 {
		return device
	}
	dev := device[:semicolonPos]
	path := device[colonPos+pathStart+1:]
	n := len(dev)
	if n > 0 && dev[n-1] == '\\' {
		dev = dev[:n-1]
	}
	return dev + path
}