Modify ↓
Opened 15 years ago
Closed 15 years ago
#1857 closed Bug (Fixed)
DriveGetFileSystem not returning expected result when no media loaded
| Reported by: | GEOSoft | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | DriveGetFileSystem, Docs, Return Value | Cc: |
Description
According to the help file a drive with no media should return the numeric 1 but returns an empty string instead.
$aDrives = DriveGetDrive("cdrom")
If NOT @Error Then
For $Drive in $aDrives
If IsNumber($Drive) Then ContinueLoop
MsgBox(0, "Result", StringUpper($Drive) & @CRLF & DriveGetFileSystem($Drive & "\"))
Next
EndIf
Tested on DVD-RW drives if it makes a difference. The trailing back slash was only added to see if it made any difference.
Also the For/In loop used in this code builds a good case for using all 0 based arrays then we don't have to check the first element for IsNumber() and numeric arrays could be used.
Attachments (0)
Change History (2)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

I should have added that there is a not so pretty work around for this issue but it really shouldn't be required in my opinion.
I also didn't mention that it was tested on Vista only.
$aDrives = DriveGetDrive("cdrom") If NOT @Error Then For $Drive in $aDrives If IsNumber($Drive) OR DriveStatus($Drive) <> "ready" Then ContinueLoop MsgBox(0, "Result", StringUpper($Drive) & @CRLF & DriveGetFileSystem($Drive & "\")) Next EndIf