Opening a stack without a .livecode extension
Graham Samuel
livfoss at mac.com
Thu Sep 29 12:49:17 EDT 2016
Thanks Richard. You're right (of course!), it’s a path problem. But it’s a pretty subtle one, since I obtained the path by executing
put specialFolderPath("preferences") & “/my preferences" into tPrefsPath
Which should have given me a cast iron result. Turns out that this produces a path with a redundant slash at the front! I don’t think this used to happen. Anyway when I delete the first char of the path, then it all works. Perhaps this is a bug - I will try to confirm it and isolate it.
To clarify, I didn’t create the original preferences stack - that was done by Jacque Gay’s Zygodact system.
Cheers
Graham
PS Sorry for the misleading subject line.
> On 29 Sep 2016, at 16:06, Richard Gaskin <ambassador at fourthworld.com> wrote:
>
> Graham wrote:
>
> > I’ve got a preferences stack which is called something like “my
> > preferences”. It’s not called “my preferences.livecode”. It’s a
> > mainstack, not a substack of any other. The path to the stack is
> > of the form
> >
> > /Users/Graham/Library/Preferences/my preferences
> >
> > If I put the path to the stack in a variable and then try to open it
> > from within another stack, as in
> >
> > go card 1 of stack pathToMyStack
> >
> > It doesn’t open and ‘exists’ says it doesn’t exist - but it can be
> > opened from the IDE.
>
> I'm assuming by "opened from the IDE" you mean via the File -> Open Stack menu item, yes?
>
> If so, then it would seem most likely the culprit is the path.
>
> With any file I/O operations it's helpful to check both the result and the sysError function; the former will let you know something is wrong, and the latter will let the OS tell you exactly what the problem is.
>
> Try this:
>
> go card 1 of stack pathToMyStack
> if the result is not empty then
> answer the result & " (&" sysError() &")" & cr \
> & pathToMyStack
> exit to top
> end if
>
> This will tell you:
> - What LiveCode thinks the problem is
> - What the OS thinks the problem is
> - Whether the path looks like what you think it should look like
>
> sysError will return an integer that reflects the OS error code. Most OS vendors provide lists of error codes, so if the error isn't obvious from the other feedback in that answer dialog a quick Google search should help you find exactly what you need to resolve it.
>
>
> > I thought at first this was because I didn’t include an extension
> > (“.livecode”), but that’s not apparently the issue.
>
> Yes, LiveCode will open any file in a valid LiveCode stack file regardless of the file name extension. This is by design, allowing us to use stack files as documents or other persistent storage in our own apps if we like.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com http://www.FourthWorld.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list