Syntax
IsDisk( cDrive ) --> lDriveExistsArguments
cDrive
A drive letter, with or without ":", for example "C" or "d:".
Return value
.T. when Windows has the drive. Always .F. on Linux, which has no drives.
Description
IsDisk() tells whether a drive letter is in use, for example before the program offers a drive for a backup.
Notes
A drive that exists may still be empty, for example a card reader without a card.
Example
PROCEDURE Main()
#if OS_WINDOWS
Check( 'IsDisk( "C" ) on Windows ', IsDisk( "C" ), .T. )
#else
Check( 'IsDisk( "C" ) on Linux ', IsDisk( "C" ), .F. )
#endif
Check( 'a digit is not a drive ', IsDisk( "1" ), .F. )
Check( 'an empty text gives .F. ', IsDisk( "" ), .F. )
RETURN
STATIC PROCEDURE Check( cTitle, xResult, xExpected )
QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )
RETURNOutput
IsDisk( "C" ) on Windows OK
a digit is not a drive OK
an empty text gives .F. OK