Where to place (sub)stacks?

Klaus Major klaus at major.on-rev.com
Wed Sep 16 08:37:55 EDT 2009


Hi Beat,

> I am completing my first commercial standalone and I am unsure of  
> where to place the (sub)stacks on the user's machine.
>
> The stack consists of a splash (main stack) with about 30 substacks.  
> Some of the substacks display data which is changed by the user and  
> needs to be saved.
> Now, where do I put my stacks on the users machine? Until now I put  
> the whole package (main stack + all substacks) into the Application  
> Folder.
> But I heard that this might cause problems (i.e. in Vista) because  
> some setups do not allow to write to files in the Application Folder.
>
> Is it a good way to place those substacks that need writing to, into  
> the Application Support Folder? If so, how do I do that with the  
> installer? I got help from Lars Bremer with the Inno Setup  
> Installer, which works great, but places all (sub)stacks into the  
> Application Folder. How will I solve this?

If I would ever need to let the users modify and save STACK files, I  
would go this way:

1. Create all the stacks that will be modified and saved by the end  
user as MAIN stacks!
2. Import each of these stacks into a custom porperty of your SPLASH/ 
main stack
...
set the cStack01 of stack "splash or whatever" to url("binfile:" &  
path_to_your_stack)
...
3. When the app starts, I would check if these stacks have already  
been "outputted" into the users "preferences folder:
Mas OS X: specialfolderpath("preferences")
## Current user only

Windows: specialfolderpath(26)
## Current user only

Might be good style to create a subfolder for your app there!

If the stacks are not yet there, I would output all the stacks from  
your CPs:
...
put specialfolderpath("preferences") into tFolder
put the cStack01 of stack "splash or whatever" into url("binfile:" &  
tFolder & "/" & "name of original stack here...")
## NO suffix necessary!
...
4. Now the user (your app) can open any of these stack, modify them  
and save them again without permission problems.

5. Pro: If a user deletes one of your stacks (c'mon, we all know how  
they are :-D) you can quickly replace it with a fresh copy!

Know what I mean?
Drop a line if not :-)

> ,,,
> Beat Cornaz

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major.on-rev.com




More information about the use-livecode mailing list