Moving a File

Marielle Lange mlange at widged.com
Wed Mar 7 07:20:54 EST 2007


> I agree I wouldn't want a dialog box either, but it would be good  
> if it either just refused to delete the file silently, returned an  
> error code and/or threw an an exception that could be "caught".

if there is a file tTargetFile then
	throw "the file already exists" -- replace by a more appropriate  
error message
else
	rename file tSourceFile to tTargetFile
end if

I expect you to tell me: If this is that simple, why didn't they code  
it like this? Because sometimes you want the ability to overwrite the  
file without an error to be thrown. The responsibility to check for  
file existence is therefore left to the programmer so to give him  
more flexibility.

Sure, a warning in the docs of the like "if the file exists, it will  
be overwitten" could be added.

Marielle




More information about the use-livecode mailing list