Modify

Opened 14 years ago

Closed 12 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 by Exit, 13 years ago

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

in reply to:  1 comment:2 by J-Paul Mesnage, 13 years ago

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 by Melba23, 12 years ago

Resolution: Rejected
Status: newclosed

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

Rejected.

M23

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.