(1) Gets the drive part of a file (or path).
(2) Returns null if it's invalid.
So it could replace this:
Code: Select all
Procedure.s GetDrivePart(path$)
d$=UCase(Left(path$,3)) : d=Asc(d$)
If Len(d$)<>3 Or d<65 Or d>90 Or Right(d$,2)<>":\"
d$=""
EndIf
ProcedureReturn d$
EndProcedure
Debug GetDrivePart("c:\boot.ini") ; Returns "C:\"
Debug GetDrivePart("iexplore.exe") ; Returns ""