There is no direct function or variable showing that a USB key is available or not and the related root path. But you can use the following workaround:
depending on the status value you know
0 : USB key is mounted and the device has no partition table --> You must use ´usb2msd:0/' for the root path of the USB memory stick
-1 : USB key is mounted but the device has a partition table --> You must use ´usb2msd:1/' for the root path of the USB memory stick
-318 : USB key not mounted
depending on the status value you know
0 : USB key is mounted and the device has no partition table --> You must use ´usb2msd:0/' for the root path of the USB memory stick
-1 : USB key is mounted but the device has a partition table --> You must use ´usb2msd:1/' for the root path of the USB memory stick
-318 : USB key not mounted