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 , 4 years ago
| Version: | 3.3.16.0 |
|---|
comment:2 by , 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 , 4 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → 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,

Automatic ticket cleanup.