Creating files/folders

Bob Sneidar bobs at twft.com
Fri Oct 5 16:44:37 EDT 2012


I would have thought a try catch construct should trap the error. However, upon testing this myself, I find it does not, and the result contains, "can't create that directory". This leads me to believe that a failure to create a directory is not considered by LC to be an error per se. From LC's perspective, the command did exactly what it was designed to do. Something to keep in mind with some of these functions. To me, error should mean, "command didn't do what it normally should have done". 

Bob


On Oct 5, 2012, at 1:02 PM, Dr. Hawkins wrote:

> On Fri, Oct 5, 2012 at 12:56 PM, Peter Haworth <pete at lcsql.com> wrote:
>> If I "open file <filepath>" for write" and the file doesn't exist LC
>> creates it.  But what happens if an error occurs? For example, the file
>> path includes a folder that doesn't exist, or permissions don't allow the
>> file to be created.  I know the file doesn't get created but how do I check
>> for an error?
>> 
>> Similarly with "create folder <pathtofolder>", how do I check for errors?
> 
> Shouldn't any such thing be in "the result"?  It has for things I've
> wanted, unless returned as a value from a function.
> 
> -- 
> Richard E. Hawkins, Esq.
> (702) 508-8462
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list