Modify

Opened 6 years ago

Closed 4 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 Changed 6 years ago by Melba23

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 Changed 4 years ago by Melba23

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.