Modify

Opened 8 years ago

Closed 6 years ago

#2221 closed Feature Request (Rejected)

FileDelete() @error values

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

Description

Request to have FileDelete() return an @error value.

Currently, FileDelete() only returns 0 if fails. If you are attempting to recursively delete files from multiple folders (say they are multiple dump folders) where some may have files and some may be empty altogether, it just returns 0.

The problem with this is that you can't know if it exited because there was a protected (locked) file that couldn't be deleted, or there was simply no file to be found. It would be nice to have @error values set upon function return.

Example @error values

0 = Successful
1 = Could Not Delete Files (Protected/Locked)
2 = Path or File does not exist (includes empty folders upon recursive use)

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 7 years ago by Exit

At least return a @error at all.
Here a function to do the job:
Func _FileDelete($sFile)

$sFile = DllCall('kernel32.dll', 'int', 'DeleteFileW', 'wstr', $sFile)
Return SetError(Not $sFile[0], 0, $sFile[0])

EndFunc ;==>_FileDelete

comment:2 in reply to: ↑ 1 Changed 7 years ago by Jpm

Replying to Exit:

At least return a @error at all.
Here a function to do the job:
Func _FileDelete($sFile)

$sFile = DllCall('kernel32.dll', 'int', 'DeleteFileW', 'wstr', $sFile)
Return SetError(Not $sFile[0], 0, $sFile[0])

EndFunc ;==>_FileDelete

THat's not what is requested.
to have the differention _WinAPIGetLastError() must be called which can be done even after calling the standard FileDelete()

comment:3 Changed 6 years ago by Melba23

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

The user should check that the required deletions have taken place, not AutoIt.

Rejected.

M23

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.