revDeleteFolder and Lessons Learned..
Alex Tweedly
alex at tweedly.net
Fri Jul 8 07:22:56 EDT 2005
Chipp Walters wrote:
> Hi Dave,
>
> Well, since I passed revDeleteFolder a single "/" and it tried to
> delete (w/out being able to be interrupted) the *entire* hard disk, I
> would say it's less dangerous to 'roll your own'. I would expect
> revDeleteFolder to take as an argument a valid path, including drive
> letter. For instance I would expect:
>
> revDeleteFolder "C:/"
>
> to delete the C drive. I don't know why just "/" does it and I'm
> afraid to test it with a null, especially since it can't be
> interrupted. Anything you roll on your own can be interrupted with a
> control-period.
>
"/" works because "/" is a valid directory specifier for Rev. You can do
set the defaultFolder to "/"
and it does; you don't need a drive specifier.
Come to think of it, you can do it in a Windows shell (or whatever a DOS
box is called these days) - "cd \" works.
> The non-interruptibility of the command is a huge issue, IMO, and one
> I'm not willing to take any more chances on. I haven't looked at the
> code, but as Xavier mentioned, it seems like it should be an engine
> level issue, not a shell call. You are certainly welcome to use it to
> your hearts content-- I won't be. Once burned, twice shy.
Being interruptible would help - but it can be hard to interrupt
scripts; sometimes takes me repeated hits on ctrl-. for up to 10
seconds, and you can delete a lot of useful files in 10 seconds.
> Dave Cragg wrote:
>
>> So do we warn people not to use revDeleteFolder, and leave them to
>> their own potentially dangerous devices. Or simply warn people to be
>> *extremely* careful when deleting folders and check they are in fact
>> deleting the intended folder.
>
I think it would be good to have an optional parameter pConfirm which
would require a user confirmation for each directory (or maybe even each
file ?). That would make it much more "comfortable" to develop and test
an application without fear of inadvertently passing a bad starting
directory, and the parameter could be reverted to (the default of) "off"
before shipping.
And as a side effect, it would need to be done in the engine rather than
as a shell command :-)
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.10/43 - Release Date: 06/07/2005
More information about the use-livecode
mailing list