Saving Data in Standalones

Peter Haworth pete at mollysrevenge.com
Mon Jun 7 17:12:46 EDT 2010


Thanks Mark, it is indeed the case that I'm logging in with admin  
privileges.

After vacillating back and forth on the best solution to this issue,  
here's what I think I'm going to do.

It turns out there are only three custom property names that I need to  
preserve between runs, although they exist in a large number of  
objects.  I think I can write a setProp handler for each of the three  
custom properties that will store their values in either my sqlite db  
or a preferences file of some sort (haven't decided on that yet).   
Each entry will consist of the object's ID as a key, plus it's value.   
I'll put the setProp handlers in my main stack's stack script so it  
will be called for any object that has those properties.

When my application starts up, I'll retrieve all these property values  
and set them into the objects that own them.  I'll have to find a  
mechanism to prevent the setProp handler from updating them again  
during that process but some sort of global variable should take care  
of that.  Alternatively, I could write a getProp handler for each of  
them I guess.

All that's left at that point is to run a one-off script that will  
locate all the instances of these custom properties and put them into  
my sqlite db/preferences file.  I already have code that locates all  
objects with a given custom property so should be a simple matter to  
add the update of the sqlite db/preferences file.

With this approach, I don;t have to worry about splitting up my  
application into two or more stack files, write access to them or the  
issue of preventing users from changing the stack files, which I think  
would probably involve a lot more work than the above solution

Be grateful for any input on this idea..

Pete Haworth

On Jun 7, 2010, at 10:00 AM, use-revolution-request at lists.runrev.com  
wrote:

> Message: 8
> Date: Mon, 7 Jun 2010 18:06:27 +0200
> From: Mark Schonewille <m.schonewille at economy-x-talk.com>
> Subject: Re: Saving Data in Standalones
> To: How to use Revolution <use-revolution at lists.runrev.com>
> Message-ID: <4D63DBD4-4428-40E3-9953-B35C3D157C86 at economy-x-talk.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> Pete,
>
> Probably, you log in on your Mac with admin privileges. That gives you
> write access to the applications folder. The guest account (Mac OS X
> 10.5 and later) and limited accounts don't have write access for the
> applications folder and several other folders. That's why you should
> avoid writing to those folders.
>
> --
> Best regards,
>
> Mark Schonewille




More information about the use-livecode mailing list