Some clues...
J. Landman Gay
jacque at hyperactivesw.com
Mon Jan 22 19:16:28 EST 2007
David Bovill wrote:
> Well the actual stack name of original "libOPN_Menus" stack somehow also
> got
> changed and saved as "libOPN_MenuExtras".
>
> So I have two stack named "libOPN_MenuExtras" - fine.
>
> But why when I do this - (no stacks in memory):
>
> put exists(stack "libOPN_Menus")
>
> The result is true, and the original stack which has been renamed somehow
> is loaded into memory - ie "libOPN_menus.rev" which has the name
> "libOPN_ExtraMenus".
There is a difference between a stack's name and its filename. Do you
mean it was renamed on disk? That won't affect its stack name.
>
> So no big deal - the right stack is loaded with the wrong name by the
> stackfiles.
>
> But doing this again:
>
> put exists(stack "libOPN_Menus")
>
> Results in that annoying dialogue which caused the inifinite loop... surely
> existence is not such a problem ? What is the rev IDE checking for and does
> anyone else know what the bug is here?
When you check for a stack's existence, the engine will open the stack
(without sending any messages) much as it does when you start using a
stack. If another stack has the same name, then you have two of them
open, which can be a problem. Before checking for existence, try:
if there is a stack <mystack> then delete stack <mystack>
assuming the stack is not a substack. If it is a substack, just close it
instead. You'll probably want to remove the stack after the existence
check too, if you aren't going to use it immediately.
Try this test:
answer file "Choose a stack file:"
put there is a stack it -- if you chose a stack, this is true
answer the mainstacks
When you look at the mainstacks, you will see the stack you chose, even
though you never specifically opened it.
One way to get around this auto-opening is to check for a "file" instead
of a "stack":
if there is a file <mystack> then...
Checking for a file does not open the file, even if it is a stack. It
just checks to make sure some kind of file with that name is at the path
you specify. This is different than checking for the existence of a
stack, because the engine needs to open and read the stack file header
to determine whether it is a stack or not. It doesn't bother opening and
reading anything when you just check for the existence of a "file".
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list