Modify

Opened 2 years ago

Closed 2 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 Changed 2 years ago by TicketCleanup

  • Version 3.3.16.0 deleted

Automatic ticket cleanup.

comment:2 Changed 2 years ago by Jos

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 Changed 2 years ago by Jpm

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

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,

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.