Modify

Opened 8 years ago

Closed 6 years ago

#3634 closed Feature Request (Rejected)

_FileListToArray error codes

Reported by: tatane Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Hi,

I'm using _FileListToArray function and I'm getting error code 4 when I don't have enough right access to the folder I want to list.

I modified this function to my need by adding "If _WinAPI_GetLastError() = 5 Then SetError(5, 0, 0)" in the code.

It's not essential but could the dev consider adding this error return ?

Thanks for your work.

Attachments (0)

Change History (2)

comment:1 by Melba23, 8 years ago

If you get the error 4 return what happens if you check yourself in the code outside the UDF for the last API error as in this amended Help file example?

#include <File.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; List all the files and folders in the desktop directory using the default parameters.
    Local $aFileList = _FileListToArray(@DesktopDir, "*")
    If @error = 1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.")
        Exit
    EndIf
    If @error = 4 Then
        If _WinAPI_GetLastError() = 5 Then
            MsgBox($MB_SYSTEMMODAL, "", "No access rights.")
        Else
            MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.")
        EndIf
        Exit
    EndIf
    ; Display the results returned by _FileListToArray.
    _ArrayDisplay($aFileList, "$aFileList")
EndFunc   ;==>Example

M23

comment:2 by Melba23, 6 years ago

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.