Replacing a stack

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Oct 21 17:52:59 CDT 2007


Hi Shari,

Remove the stack from memory, before opening the new version.

lock messages
delete stack "Your Stack" -- remove from memory
go stack "Mac HD/Folder/Your Stack.rev"
put the xVersion of stack "Your Stack" --> 10
unlock messages

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Quickly extract data from your HyperCard stacks with DIFfersifier.  
http://differsifier.economy-x-talk.com


Op 22-okt-2007, om 0:44 heeft Shari het volgende geschreven:

> This problem is buggering me.  My app creates a preferences stack  
> in some writeable folder (Preferences on Mac OSX and varying  
> locations on Windows depending on the system).
>
> I want to be able to replace this stack with a newer version if  
> there is a need to.
>
> The newer version has an xVersion number of 10, has been compressed  
> and saved as the stackData of the application itself.
>
> The older version (in the Prefs folder) has an xVersion of 7.
>
> When the app launches it checks the versions, and discovers that  
> the stack in the Prefs folder needs to be replaced.  So it deletes  
> that stack.  In testing I have it answer someMessage and with the  
> answer window open, can verify that the old stack is indeed deleted  
> from the prefs folder.
>
> It then decompresses the stackData of the app and puts it into  
> binfile:prefsLocation.  I know beyond a doubt that the stackData  
> has the right version of 10.
>
> But after it decompresses and creates the new Prefs stack, I check  
> the version and it's 7, the same version of the deleted stack.
>
> What am I missing?  I had tried at one time to just have it copy a  
> stack from one folder to another, each stack having a different  
> name, having it copy and rename the stack, but no matter how I did  
> it I kept getting that annoying "stack is already running, do you  
> want to purge it?" dialog.  So I thought to try the compress/ 
> decompress/binfile approach instead.
>
> I am using the same compress/decompress/binfile code that I have  
> already working with another stack.  So I know this code is good.
>
> Any thoughts?  Suggestions?  Is there a way to read the compressed  
> data and verify the xVersion before it actually creates the new stack?
>
> Shari





More information about the use-livecode mailing list