DeleteFile with force flags

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
ctg
User
User
Posts: 21
Joined: Mon Sep 15, 2008 1:43 am

DeleteFile with force flags

Post by ctg »

G'day, just a quickie.

May the #PB_FileSystem_Force flag please be added as an option to DeleteFile, or DeleteFile and DeleteDirectory me merged into the one function? I can use DeleteDirectory to remove read-only files but it's not really logical.


Cheers.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: DeleteFile with force flags

Post by IdeasVacuum »

.... I think that might be difficult to achieve as a general command, at least on Windows (possibly even more so on Windows8). DeleteFile() will already delete deletable files. Files that won't delete will be locked in some way, either because they are opened and in use by another app or because the OS needs them to stay alive. Even the file unlock apps available cannot always delete a file, they merely record it's name and delete it on startup/reboot.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
ctg
User
User
Posts: 21
Joined: Mon Sep 15, 2008 1:43 am

Re: DeleteFile with force flags

Post by ctg »

IdeasVacuum wrote:.... I think that might be difficult to achieve as a general command, at least on Windows (possibly even more so on Windows8). DeleteFile() will already delete deletable files. Files that won't delete will be locked in some way, either because they are opened and in use by another app or because the OS needs them to stay alive. Even the file unlock apps available cannot always delete a file, they merely record it's name and delete it on startup/reboot.
I understand your point regarding locked files, but read-only files aren't inherently locked by the OS. :wink:
Post Reply