Scope Problem on Standalones

Sarah Reichelt sarah.reichelt at gmail.com
Sat Nov 26 06:31:48 EST 2005


> > I have an application that is comprised on a number of stacks.
>
> The top level stack is built into a Standalone and it calls other
> stacks (.rev files) via "start using" and "go stack" commands.
>
> When in the IDE the folder stucture is like this:
>
> BaseFolder/StartUp.rev <-- just contains a splash screen
> BaseFolder/Runtime/Stacks/StackA.rev
> BaseFolder/Runtime/Stacks/StackB.rev
> BaseFolder/Runtime/Stacks/StackC.rev
>
> StartUp.rev figures out the correct path (by using the filename of
> this stack property) and does a goto StackA.rev.
> StackA in turn does a go to StackB.rev. This all works fine under the IDE.
>
> When runnig as a standalone the folder structure is like this:
>
> MacOSX/myApp.app  <-- bundle
> MacOSX/myApp.app/Contents/MacOS/MyApp (real applicaiton)
> MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackA.rev
> MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackB.rev
> MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackC.rev
>

I can't  see why your soution doesn't work, but here is what I do in
similar circumstances:

In the preOpenStack handler on card 1 of stack "StackA":

on preOpenStack
    put applicationFolder(the short name of this stack) into tFolder
    set the defaultfolder to tFolder
    start using stack "StackA"
end preOpenStack

function applicationFolder pStack
    if pStack is empty then put the short name of this stack into pStack
    put the effective filename of stack pStack into tFull
    put empty into tFolder
    set the itemdel to "/"
    repeat for each item i in tFull
        if i contains ".app" or i contains ".rev" then exit repeat
        put i & "/" after tFolder
    end repeat
    return tFolder
end applicationFolder

This function is stripped down to work only with OS X. If you want a
cross-platform equivalent, let me know.

HTH,
Sarah



More information about the use-livecode mailing list