Modify

Opened 4 years ago

Closed 4 years ago

#3874 closed Feature Request (Rejected)

FileOpen() and similar functions should set @error to non-zero on failure

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

Description

I wonder why some File* and all Dir* functions don't set @error to non-zero on failure? Imho this is not a bug, but breaks uniformity somehow…
For example, could FileOpen() set such @error flags as these?
1 = file not found
2 = access denied
3 = $FO_APPEND/$FO_OVERWRITE set while file is read-only
… etc
Thank you for attention!

Attachments (0)

Change History (3)

comment:1 by TicketCleanup, 4 years ago

Version: 3.3.16.0

Automatic ticket cleanup.

comment:2 by Jos, 4 years ago

You are assuming that AutoIt3 knows all these conditions, in stead of just trying to open the file and returning a @error=-1 in case it fails.

Just make your own UDF _FileOpen() that does these extra checks and balances as that really should be pretty simply to code when required. ;)

comment:3 by J-Paul Mesnage, 4 years ago

Resolution: Rejected
Status: newclosed

It is true that, from the beginning, a lot of AutoIt builtin function was not using the @error.
It would be a hard work to introduce @error in these functions.
But perhaps you can easy use _WinAPI_GetLasterror() in a udf as mention by Jos,

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.