You are not logged in.
Pages: 1
Hi Denis,
Would it be possible for safety purposes to modify WideDeleteFile() so that it can optionally delete to the Recycle Bin? In short, change this:
function WideDeleteFile(const FileName: WideString): Boolean;
to something like this:
function WideDeleteFile(const FileName: WideString; UseRecycleBin: Boolean): Boolean;
I'm assuming if this is done then standard Windows APIs will be used, so the OS itself will take care of things like checking if the Recycle Bin is available or not, whether it is large enough to contain the deleted file and so on.
Offline
Absolutely. This should get added in v6.4.0.1 Beta.
The function will probably be called WideDeleteFileToRecycleBin, to keep the signature of existing functions unchanged for backwards compatibility.
Offline
Absolutely. This should get added in v6.4.0.1 Beta.
Thanks!
The function will probably be called WideDeleteFileToRecycleBin, to keep the signature of existing functions unchanged for backwards compatibility.
Doesn't PS have the concept of default arguments, or function overloading? That way both single and multiple arguments would work with the same function name and no existing code would break. In fact, it would probably help to consolidate other functions having multiple versions too, and would lead to an overall cleaner API.
Also, is the lack of a complementary WideDeleteDir() function deliberate, or just something that hasn't been implemented yet? Wonder if it makes sense, especially considering that things like recursive deletion, non-empty dirs etc. will need to be dealt with. Perhaps best not to add it from a safety perspective, or perhaps only WideDeleteEmptyDir() can be added?
Last edited by Andrew (2016-03-23 17:38)
Offline
Doesn't PS have the concept of default arguments, or function overloading?
PascalScript engine doesn't support parameter defaults and function overloading.
Is the lack of a complementary WideDeleteDir() function deliberate, or just something that hasn't been implemented yet?
Nobody has asked for it, until now.
It will be added as WideRemoveDir and will remove a directory only if it is empty, just like in FPC and Delphi.
Offline
PascalScript engine doesn't support parameter defaults and function overloading.
Too bad. Oh well, can't be helped I suppose.
That'll do nicely. Waiting for 6.4.0.1 now.
Offline
Pages: 1