Code Libraries and Standalone Applications
sarah.reichelt at gmail.com
Sat Apr 17 20:11:12 EDT 2010
On Sun, Apr 18, 2010 at 7:41 AM, Peter Haworth <pete at mollysrevenge.com> wrote:
> I'm hoping I can get some advice from the people on this list who know a lot
> more that I do about the mechanics of distributing a standalone application.
> While developing my application, I wrote a number of commands that I insert
> as front scripts to the app. The scripts for these command were all on
> cards within the application stack file but I've moved them out of that file
> and into a separate code library file so I can use them in other future
> apps. I changed the insert commands in my application to load the scripts
> from the code library stack file instead of from the application stack file
> and all seems to be working fine after a couple of initial glitches.
> Now I'm realising that when I distribute the application as a standalone,
> the file path to the code library stack (currently hard coded in my app)
> will certainly be different than it is on my computer.
> I have the same issue with a library of objects with custom behaviors that
> currently resides on a card in my application which I would like to move
> out of the application and into a separate object library stack file for use
> in other apps. Plus, there's a more difficult problem with the object
> library in that the behavior definitions are all hard coded long ids that
> include a reference to the file path to my application stack.
> I guess I could just include a copy of both library stacks in every app but
> that seems to defeat the purpose of central libraries
> I'm sure these problems have been solved many times and I'd appreciate some
> guidance on the best way to handle this before I go charging down the wrong
I use "the stackFiles" to solve the library problem. The library files
DO need to be included with each app or the app will not be able to
find them & use them.
If you set the stackFiles using the Inspector, you can refer to the
library stacks by name only and your main stack will know where to
The library stacks do not have to be included in your working stack file.
When you build the app, the standalone builder will automatically
include these stackFiles in the app, and you will still be able to
refer to them just by name, with no file path needed.
For behaviors, I don't know how this works out. When I have a bunch of
objects that need to be set to use a behavior, I write a handler to
loop through them and set them all. As a precaution, I have just left
these handlers in the stacks and call them in an openCard or openStack
routine. This is probably overkill, but at least I know it works.
More information about the Use-livecode