Replacing a stack

Shari shari at gypsyware.com
Sun Oct 21 18:44:54 EDT 2007


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
-- 
WlND0WS and MAClNT0SH shareware games
BIackjack GoId
http://www.gypsyware.com



More information about the use-livecode mailing list